Skip to content

Commit 71fb1e6

Browse files
committed
Switched to pwrtelegram
1 parent ff5f6f7 commit 71fb1e6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

telebot/apihelper.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
logger = telebot.logger
99

10-
API_URL = "https://api.telegram.org/bot{0}/{1}"
11-
FILE_URL = "https://api.telegram.org/file/bot{0}/{1}"
10+
API_URL = "https://api.pwrtelegram.xyz/bot{0}/{1}"
11+
FILE_URL = "https://storage.pwrtelegram.xyz/{0}"
1212

1313
CONNECT_TIMEOUT = 3.5
1414
READ_TIMEOUT = 9999
@@ -32,6 +32,8 @@ def _make_request(token, method_name, method='get', params=None, files=None, bas
3232
if 'timeout' in params: read_timeout = params['timeout'] + 10
3333
if 'connect-timeout' in params: connect_timeout = params['connect-timeout'] + 10
3434
result = requests.request(method, request_url, params=params, files=files, timeout=(connect_timeout, read_timeout))
35+
while result.status_code == 202:
36+
result = requests.request(method, request_url, params=params, files=files, timeout=(connect_timeout, read_timeout))
3537
logger.debug("The server returned: '{0}'".format(result.text.encode('utf8')))
3638
return _check_result(method_name, result)['result']
3739

@@ -79,7 +81,7 @@ def get_file(token, file_id):
7981

8082

8183
def download_file(token, file_path):
82-
url = FILE_URL.format(token, file_path)
84+
url = FILE_URL.format(file_path)
8385
result = requests.get(url)
8486
if result.status_code != 200:
8587
msg = 'The server returned HTTP {0} {1}. Response body:\n[{2}]' \

0 commit comments

Comments
 (0)