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