mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-16 12:25:45 +01:00
Merge pull request #583 from whipermr5/gae-urllib3-support
Compatibility with GAE via urllib3.contrib package
This commit is contained in:
commit
284f16b87b
2 changed files with 7 additions and 1 deletions
|
@ -24,6 +24,7 @@ The following wonderful people contributed directly or indirectly to this projec
|
|||
- `Jacob Bom <https://github.com/bomjacob>`_
|
||||
- `JASON0916 <https://github.com/JASON0916>`_
|
||||
- `jh0ker <https://github.com/jh0ker>`_
|
||||
- `John Yong <https://github.com/whipermr5>`_
|
||||
- `jossalgon <https://github.com/jossalgon>`_
|
||||
- `JRoot3D <https://github.com/JRoot3D>`_
|
||||
- `jlmadurga <https://github.com/jlmadurga>`_
|
||||
|
|
|
@ -28,6 +28,7 @@ except ImportError:
|
|||
|
||||
import certifi
|
||||
import urllib3
|
||||
import urllib3.contrib.appengine
|
||||
from urllib3.connection import HTTPConnection
|
||||
from urllib3.util.timeout import Timeout
|
||||
try:
|
||||
|
@ -93,7 +94,11 @@ class Request(object):
|
|||
proxy_url = os.environ.get('HTTPS_PROXY') or os.environ.get('https_proxy')
|
||||
|
||||
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:
|
||||
kwargs.update(urllib3_proxy_kwargs)
|
||||
if proxy_url.startswith('socks'):
|
||||
|
|
Loading…
Add table
Reference in a new issue