Close certificate file after setting webhook
This commit is contained in:
parent
94d563b276
commit
3e6fc8ba42
@ -208,15 +208,15 @@ class TelegramBot(object):
|
||||
try:
|
||||
certificate = open(certificate, 'r')
|
||||
except FileNotFoundError as e:
|
||||
logging.error(f"{e}")
|
||||
logging.error(f"{e}\nCertificate set to `None`")
|
||||
certificate = None
|
||||
# certificate = dict(
|
||||
# file=certificate
|
||||
# )
|
||||
return await self.api_request(
|
||||
result = await self.api_request(
|
||||
'setWebhook',
|
||||
parameters=locals()
|
||||
)
|
||||
if certificate is not None: # Close certificate file, if it was open
|
||||
certificate.close()
|
||||
return result
|
||||
|
||||
async def deleteWebhook(self):
|
||||
"""Remove webhook integration and switch back to getUpdate.
|
||||
|
Loading…
x
Reference in New Issue
Block a user