mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-02-18 03:16:35 +01:00
GAE support via urllib3.contrib.appengine module #334
This commit is contained in:
parent
4541476143
commit
1d905d567c
1 changed files with 6 additions and 1 deletions
|
@ -28,6 +28,7 @@ except ImportError:
|
||||||
|
|
||||||
import certifi
|
import certifi
|
||||||
import urllib3
|
import urllib3
|
||||||
|
import urllib3.contrib.appengine
|
||||||
from urllib3.connection import HTTPConnection
|
from urllib3.connection import HTTPConnection
|
||||||
from urllib3.util.timeout import Timeout
|
from urllib3.util.timeout import Timeout
|
||||||
try:
|
try:
|
||||||
|
@ -93,7 +94,11 @@ class Request(object):
|
||||||
proxy_url = os.environ.get('HTTPS_PROXY') or os.environ.get('https_proxy')
|
proxy_url = os.environ.get('HTTPS_PROXY') or os.environ.get('https_proxy')
|
||||||
|
|
||||||
if not proxy_url:
|
if not proxy_url:
|
||||||
mgr = urllib3.PoolManager(**kwargs)
|
if urllib3.contrib.appengine.is_appengine_sandbox():
|
||||||
|
# Use URLFetch service if running in App Engine
|
||||||
|
mgr = urllib3.contrib.appengine.AppEngineManager()
|
||||||
|
else:
|
||||||
|
mgr = urllib3.PoolManager(**kwargs)
|
||||||
else:
|
else:
|
||||||
kwargs.update(urllib3_proxy_kwargs)
|
kwargs.update(urllib3_proxy_kwargs)
|
||||||
if proxy_url.startswith('socks'):
|
if proxy_url.startswith('socks'):
|
||||||
|
|
Loading…
Add table
Reference in a new issue