closed aiohttp connections after use
This commit is contained in:
parent
35e30f33d4
commit
f5f46878de
1 changed files with 2 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ async def answer_question(topic, model="gpt-3.5-turbo"): # Only needed for draw
|
||||||
async with http_session.post(url, headers=headers, json=data) as resp:
|
async with http_session.post(url, headers=headers, json=data) as resp:
|
||||||
response_data = await resp.json()
|
response_data = await resp.json()
|
||||||
response = response_data['choices'][0]['message']['content']
|
response = response_data['choices'][0]['message']['content']
|
||||||
|
aiohttp.close()
|
||||||
return response
|
return response
|
||||||
|
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
|
|
@ -105,6 +106,7 @@ async def meme(ctx):
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
await handle_error(error)
|
await handle_error(error)
|
||||||
print("Something's Wrong with the urllib So try again")
|
print("Something's Wrong with the urllib So try again")
|
||||||
|
aiohttp.close()
|
||||||
return image_link, filename
|
return image_link, filename
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue