X Tutup
Skip to content

Commit 1d905d5

Browse files
committed
GAE support via urllib3.contrib.appengine module python-telegram-bot#334
1 parent 4541476 commit 1d905d5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

telegram/utils/request.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import certifi
3030
import urllib3
31+
import urllib3.contrib.appengine
3132
from urllib3.connection import HTTPConnection
3233
from urllib3.util.timeout import Timeout
3334
try:
@@ -93,7 +94,11 @@ def __init__(self,
9394
proxy_url = os.environ.get('HTTPS_PROXY') or os.environ.get('https_proxy')
9495

9596
if not proxy_url:
96-
mgr = urllib3.PoolManager(**kwargs)
97+
if urllib3.contrib.appengine.is_appengine_sandbox():
98+
# Use URLFetch service if running in App Engine
99+
mgr = urllib3.contrib.appengine.AppEngineManager()
100+
else:
101+
mgr = urllib3.PoolManager(**kwargs)
97102
else:
98103
kwargs.update(urllib3_proxy_kwargs)
99104
if proxy_url.startswith('socks'):

0 commit comments

Comments
 (0)
X Tutup