telebot proxy
This commit is contained in:
parent
183f9afff2
commit
c5e3a7fa97
@ -4,6 +4,7 @@ from threading import Event
|
||||
from typing import Optional, List
|
||||
|
||||
import telebot
|
||||
from telebot import apihelper
|
||||
from telebot.types import InputFile
|
||||
|
||||
from app.core.config import settings
|
||||
@ -13,6 +14,9 @@ from app.utils.http import RequestUtils
|
||||
from app.utils.singleton import Singleton
|
||||
|
||||
|
||||
apihelper.proxy = settings.PROXY
|
||||
|
||||
|
||||
class Telegram(metaclass=Singleton):
|
||||
_ds_url = f"http://127.0.0.1:{settings.PORT}/api/v1/messages?token={settings.API_TOKEN}"
|
||||
_event = Event()
|
||||
@ -154,7 +158,7 @@ class Telegram(metaclass=Singleton):
|
||||
"""
|
||||
|
||||
if image:
|
||||
req = RequestUtils().get_res(image)
|
||||
req = RequestUtils(proxies=settings.PROXY).get_res(image)
|
||||
if req and req.content:
|
||||
image_file = Path(settings.TEMP_PATH) / Path(image).name
|
||||
image_file.write_bytes(req.content)
|
||||
|
Loading…
x
Reference in New Issue
Block a user