🐛 Speedtest fix timeout (#165)

* 🐛 修复 speedtest 请求超时
This commit is contained in:
Xtao_dada 2022-01-19 11:35:52 +08:00 committed by GitHub
parent 15d07ee621
commit 4239cfb5e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -13,11 +13,12 @@ from telethon import version as telethon_version
from telethon.tl.types import User, Chat, Channel from telethon.tl.types import User, Chat, Channel
from sys import platform from sys import platform
from re import sub, findall from re import sub, findall
from requests import get
from pathlib import Path from pathlib import Path
from pagermaid import log, config, redis_status, start_time, silent from pagermaid import log, config, redis_status, start_time, silent
from pagermaid.utils import execute, upload_attachment from pagermaid.utils import execute, upload_attachment
from pagermaid.listener import listener from pagermaid.listener import listener
from pagermaid.utils import lang, alias_command, get from pagermaid.utils import lang, alias_command
DCs = { DCs = {
1: "149.154.175.50", 1: "149.154.175.50",
@ -196,7 +197,7 @@ async def speedtest(context):
f"Timestamp: `{result['timestamp']}`" f"Timestamp: `{result['timestamp']}`"
) )
# 开始处理图片 # 开始处理图片
data = (await get(f"{result['result']['url']}.png")).text data = get(f"{result['result']['url']}.png").content
with open('speedtest.png', mode='wb') as f: with open('speedtest.png', mode='wb') as f:
f.write(data) f.write(data)
try: try:
@ -273,7 +274,7 @@ async def speedtest(context):
f"Timestamp: `{result['timestamp']}`" f"Timestamp: `{result['timestamp']}`"
) )
# 开始处理图片 # 开始处理图片
data = (await get(result['share'])).text data = get(result['share']).content
with open('speedtest.png', mode='wb') as f: with open('speedtest.png', mode='wb') as f:
f.write(data) f.write(data)
try: try:

View File

@ -13,8 +13,8 @@ formatted_today = datetime.date.today().strftime('%y%m%d')
setup( setup(
name="pagermaid_modify", name="pagermaid_modify",
version=formatted_today[0:2] + "." + formatted_today[2:4] + "." + formatted_today[4:6] + ".post1", version=formatted_today[0:2] + "." + formatted_today[2:4] + "." + formatted_today[4:6] + ".post1",
author="xtaodada", author="Xtao-Labs",
author_email="xtao@xtaolink.cn", author_email="xtao@xtaolabs.com",
description="A telegram utility daemon and plugin framework.", description="A telegram utility daemon and plugin framework.",
long_description=long_description, long_description=long_description,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",