🎨 Update timeout config of Hyperion client

This commit is contained in:
洛水居室 2023-03-22 13:09:24 +08:00
parent 9a1b9271e7
commit 8814979cef
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 11 additions and 3 deletions

View File

@ -25,8 +25,8 @@ class Hyperion:
"Chrome/90.0.4430.72 Safari/537.36"
)
def __init__(self):
self.client = HyperionRequest(headers=self.get_headers())
def __init__(self, *args, **kwargs):
self.client = HyperionRequest(headers=self.get_headers(), *args, **kwargs)
@staticmethod
def extract_post_id(text: str) -> int:

View File

@ -1,6 +1,7 @@
from typing import List, Optional, Tuple, TYPE_CHECKING, Union
from bs4 import BeautifulSoup
from httpx import Timeout
from telegram import (
InlineKeyboardButton,
InlineKeyboardMarkup,
@ -47,7 +48,14 @@ class Post(Plugin.Conversation):
MENU_KEYBOARD = ReplyKeyboardMarkup([["推送频道", "添加TAG"], ["编辑文字", "删除图片"], ["退出"]], True, True)
def __init__(self):
self.bbs = Hyperion()
self.bbs = Hyperion(
timeout=Timeout(
connect=config.connect_timeout,
read=config.read_timeout,
write=config.write_timeout,
pool=config.pool_timeout,
)
)
self.last_post_id_list: List[int] = []
async def initialize(self):