🐛 增加 certifi 处理 sticker 请求网页 ssl 证书问题

This commit is contained in:
xtaodada 2020-08-16 17:08:16 +08:00
parent a73f289bde
commit 00e59fe51a
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 5 additions and 2 deletions

View File

@ -1,5 +1,7 @@
""" PagerMaid module to handle sticker collection. """ """ PagerMaid module to handle sticker collection. """
import certifi
import ssl
from asyncio import sleep from asyncio import sleep
from os import remove from os import remove
from urllib import request from urllib import request
@ -88,7 +90,7 @@ async def sticker(context):
command = '/newanimated' command = '/newanimated'
response = request.urlopen( response = request.urlopen(
request.Request(f'http://t.me/addstickers/{pack_name}')) request.Request(f'http://t.me/addstickers/{pack_name}'), context=ssl.create_default_context(cafile=certifi.where()))
if not response.status == 200: if not response.status == 200:
await context.edit("连接到 Telegram 服务器失败 . . .") await context.edit("连接到 Telegram 服务器失败 . . .")
return return

View File

@ -32,3 +32,4 @@ flask_wtf
wtforms wtforms
cheroot cheroot
PySocks PySocks
certifi