com.googler.python 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/python3.4.2/lib/python3.4/site-packages/pip/__init__.py +1 -277
- package/python3.4.2/lib/python3.4/site-packages/pip/__main__.py +19 -7
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/__init__.py +246 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/basecommand.py +373 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/{baseparser.py → _internal/baseparser.py} +240 -224
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/build_env.py +92 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/cache.py +202 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/cmdoptions.py +609 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/__init__.py +79 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/check.py +42 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/completion.py +94 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/configuration.py +227 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/download.py +233 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/freeze.py +96 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/hash.py +57 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/{commands → _internal/commands}/help.py +36 -33
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/install.py +477 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/list.py +343 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/search.py +135 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/show.py +164 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/uninstall.py +71 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/wheel.py +179 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/compat.py +235 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/configuration.py +378 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/download.py +922 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/exceptions.py +249 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/index.py +1117 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/locations.py +194 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/models/__init__.py +4 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/models/index.py +15 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/{_vendor/requests/packages/urllib3/contrib → _internal/operations}/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/check.py +106 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/freeze.py +252 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/prepare.py +378 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/pep425tags.py +317 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/__init__.py +69 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_file.py +338 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_install.py +1115 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_set.py +164 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_uninstall.py +455 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/resolve.py +354 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/{status_codes.py → _internal/status_codes.py} +8 -6
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/appdirs.py +258 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/deprecation.py +77 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/encoding.py +33 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/filesystem.py +28 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/glibc.py +84 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/hashes.py +94 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/logging.py +132 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/misc.py +851 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/outdated.py +163 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/packaging.py +70 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/setuptools_build.py +8 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/temp_dir.py +82 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/typing.py +29 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/ui.py +421 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/__init__.py +471 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/bazaar.py +113 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/git.py +311 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/mercurial.py +105 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/subversion.py +271 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_internal/wheel.py +817 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/__init__.py +109 -8
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/appdirs.py +604 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/__init__.py +11 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/_cmd.py +60 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/adapter.py +134 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/cache.py +39 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +2 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +133 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +43 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/compat.py +29 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/controller.py +373 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/filewrapper.py +78 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/heuristics.py +138 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/serialize.py +194 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/wrapper.py +27 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/__init__.py +3 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/__main__.py +2 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests → certifi}/cacert.pem +1765 -2358
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/core.py +37 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/__init__.py +39 -32
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/big5freq.py +386 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/big5prober.py +47 -42
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/chardistribution.py +233 -231
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/charsetgroupprober.py +106 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/charsetprober.py +145 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/cli/__init__.py +1 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/cli/chardetect.py +85 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/codingstatemachine.py +88 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/compat.py +34 -34
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/cp949prober.py +49 -44
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/enums.py +76 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/escprober.py +101 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/escsm.py +246 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/eucjpprober.py +92 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/euckrfreq.py +195 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euckrprober.py +47 -42
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euctwfreq.py +387 -428
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euctwprober.py +46 -41
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/gb2312freq.py +283 -472
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/gb2312prober.py +46 -41
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/hebrewprober.py +292 -283
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/jisfreq.py +325 -569
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/jpcntx.py +233 -219
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langbulgarianmodel.py +228 -229
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langcyrillicmodel.py +333 -329
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langgreekmodel.py +225 -225
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langhebrewmodel.py +200 -201
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langhungarianmodel.py +225 -225
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langthaimodel.py +199 -200
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/langturkishmodel.py +193 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/latin1prober.py +145 -139
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/mbcharsetprober.py +91 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/mbcsgroupprober.py +54 -54
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/mbcssm.py +572 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/sbcharsetprober.py +132 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/sbcsgroupprober.py +73 -69
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/sjisprober.py +92 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/universaldetector.py +286 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/utf8prober.py +82 -76
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/version.py +9 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/__init__.py +7 -7
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/ansi.py +102 -50
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/ansitowin32.py +236 -190
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/initialise.py +82 -56
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/win32.py +156 -137
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/winterm.py +162 -120
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/__init__.py +23 -23
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/__init__.py +6 -6
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/misc.py +41 -41
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/shutil.py +761 -761
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/sysconfig.cfg +84 -84
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/sysconfig.py +788 -788
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/tarfile.py +2607 -2607
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/compat.py +1117 -1064
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/database.py +1318 -1301
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/index.py +516 -488
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/locators.py +1292 -1194
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/manifest.py +393 -364
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/markers.py +131 -190
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/metadata.py +1068 -1026
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/resources.py +355 -317
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py +415 -323
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/t32.exe +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/t64.exe +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/util.py +1755 -1575
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/version.py +736 -721
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/w32.exe +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/w64.exe +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/wheel.py +984 -958
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distro.py +1104 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/__init__.py +35 -23
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{ihatexml.py → _ihatexml.py} +288 -285
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{inputstream.py → _inputstream.py} +923 -881
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{tokenizer.py → _tokenizer.py} +1721 -1731
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/__init__.py +14 -12
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/_base.py +37 -37
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/datrie.py +44 -44
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/py.py +67 -67
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{utils.py → _utils.py} +124 -82
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/constants.py +2947 -3104
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.py +29 -20
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/{_base.py → base.py} +12 -12
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/inject_meta_charset.py +73 -65
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/lint.py +93 -93
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/optionaltags.py +207 -205
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/sanitizer.py +896 -12
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/whitespace.py +38 -38
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/html5parser.py +2791 -2713
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer.py +409 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/__init__.py +30 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/genshi.py +54 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/sax.py +50 -44
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/__init__.py +88 -76
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/{_base.py → base.py} +417 -377
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/dom.py +236 -227
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/etree.py +340 -337
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.py +366 -369
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py +154 -57
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{_base.py → base.py} +252 -200
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/dom.py +43 -46
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/etree.py +130 -138
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{lxmletree.py → etree_lxml.py} +213 -208
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{genshistream.py → genshi.py} +69 -69
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/__init__.py +2 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/codec.py +118 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/compat.py +12 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/core.py +387 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/idnadata.py +1585 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/intranges.py +53 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/package_data.py +2 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/uts46data.py +7634 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/ipaddress.py +2419 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/__init__.py +347 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/linklockfile.py +73 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/mkdirlockfile.py +84 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/pidlockfile.py +190 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/sqlitelockfile.py +156 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/symlinklockfile.py +70 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/__init__.py +66 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/_version.py +1 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/exceptions.py +41 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/fallback.py +971 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/__about__.py +21 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/__init__.py +14 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/_compat.py +30 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/_structures.py +70 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/markers.py +301 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/requirements.py +130 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/specifiers.py +774 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/utils.py +63 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/version.py +441 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{pkg_resources.py → pkg_resources/__init__.py} +3125 -2762
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources/py31compat.py +22 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/__init__.py +127 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/bar.py +88 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/counter.py +48 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/helpers.py +91 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/spinner.py +44 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pyparsing.py +5720 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/__init__.py +3 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/core.py +13 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/parser.py +374 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/writer.py +127 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/__init__.py +123 -77
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/__version__.py +14 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/_internal_utils.py +42 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/adapters.py +525 -388
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/api.py +152 -120
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/auth.py +293 -193
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/certs.py +18 -24
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/compat.py +73 -115
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/cookies.py +542 -454
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/exceptions.py +122 -75
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/help.py +120 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/hooks.py +34 -45
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/models.py +948 -803
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages.py +16 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py +737 -637
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/status_codes.py +91 -88
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/structures.py +105 -127
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/utils.py +904 -673
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/retrying.py +267 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/six.py +891 -646
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/__init__.py +97 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/_collections.py +319 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/connection.py +373 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/connectionpool.py +905 -710
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +593 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +343 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/appengine.py +296 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/contrib/ntlmpool.py +112 -120
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +455 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +810 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/socks.py +188 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/exceptions.py +246 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/fields.py +178 -177
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/filepost.py +94 -100
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/__init__.py +5 -4
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +53 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ordered_dict.py +259 -260
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/six.py +868 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ssl_match_hostname/__init__.py +19 -13
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ssl_match_hostname/_implementation.py +157 -105
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/poolmanager.py +440 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/request.py +148 -141
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/response.py +626 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/__init__.py +54 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/connection.py +130 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/request.py +118 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/response.py +81 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/retry.py +401 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/selectors.py +581 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/ssl_.py +341 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/util/timeout.py +242 -234
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/util/url.py +230 -162
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/wait.py +40 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/__init__.py +342 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/labels.py +231 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/mklabels.py +59 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/tests.py +153 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/x_user_defined.py +325 -0
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/_markerlib/__init__.py +0 -16
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/_markerlib/markers.py +0 -119
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/sanitizer.py +0 -271
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer/__init__.py +0 -16
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer/htmlserializer.py +0 -320
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/pulldom.py +0 -63
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/re-vendor.py +0 -34
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/__init__.py +0 -3
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/big5freq.py +0 -925
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/chardetect.py +0 -46
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/charsetgroupprober.py +0 -106
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/charsetprober.py +0 -62
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/codingstatemachine.py +0 -61
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/constants.py +0 -39
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/escprober.py +0 -86
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/escsm.py +0 -242
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/eucjpprober.py +0 -90
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/euckrfreq.py +0 -596
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/mbcharsetprober.py +0 -86
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/mbcssm.py +0 -575
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/sbcharsetprober.py +0 -120
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/sjisprober.py +0 -91
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/universaldetector.py +0 -170
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py +0 -58
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/_collections.py +0 -205
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connection.py +0 -204
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py +0 -422
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/exceptions.py +0 -126
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/packages/six.py +0 -385
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py +0 -258
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/response.py +0 -308
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/__init__.py +0 -27
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/connection.py +0 -45
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/request.py +0 -68
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/response.py +0 -13
- package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py +0 -133
- package/python3.4.2/lib/python3.4/site-packages/pip/backwardcompat/__init__.py +0 -138
- package/python3.4.2/lib/python3.4/site-packages/pip/basecommand.py +0 -201
- package/python3.4.2/lib/python3.4/site-packages/pip/cmdoptions.py +0 -371
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/__init__.py +0 -88
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/bundle.py +0 -42
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/completion.py +0 -59
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/freeze.py +0 -114
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/install.py +0 -314
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/list.py +0 -162
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/search.py +0 -132
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/show.py +0 -80
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/uninstall.py +0 -59
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/unzip.py +0 -7
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/wheel.py +0 -195
- package/python3.4.2/lib/python3.4/site-packages/pip/commands/zip.py +0 -351
- package/python3.4.2/lib/python3.4/site-packages/pip/download.py +0 -644
- package/python3.4.2/lib/python3.4/site-packages/pip/exceptions.py +0 -46
- package/python3.4.2/lib/python3.4/site-packages/pip/index.py +0 -990
- package/python3.4.2/lib/python3.4/site-packages/pip/locations.py +0 -171
- package/python3.4.2/lib/python3.4/site-packages/pip/log.py +0 -276
- package/python3.4.2/lib/python3.4/site-packages/pip/pep425tags.py +0 -102
- package/python3.4.2/lib/python3.4/site-packages/pip/req.py +0 -1931
- package/python3.4.2/lib/python3.4/site-packages/pip/runner.py +0 -18
- package/python3.4.2/lib/python3.4/site-packages/pip/util.py +0 -720
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/__init__.py +0 -251
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/bazaar.py +0 -131
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/git.py +0 -194
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/mercurial.py +0 -151
- package/python3.4.2/lib/python3.4/site-packages/pip/vcs/subversion.py +0 -273
- package/python3.4.2/lib/python3.4/site-packages/pip/wheel.py +0 -560
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Low-level helpers for the SecureTransport bindings.
|
|
3
|
+
|
|
4
|
+
These are Python functions that are not directly related to the high-level APIs
|
|
5
|
+
but are necessary to get them to work. They include a whole bunch of low-level
|
|
6
|
+
CoreFoundation messing about and memory management. The concerns in this module
|
|
7
|
+
are almost entirely about trying to avoid memory leaks and providing
|
|
8
|
+
appropriate and useful assistance to the higher-level code.
|
|
9
|
+
"""
|
|
10
|
+
import base64
|
|
11
|
+
import ctypes
|
|
12
|
+
import itertools
|
|
13
|
+
import re
|
|
14
|
+
import os
|
|
15
|
+
import ssl
|
|
16
|
+
import tempfile
|
|
17
|
+
|
|
18
|
+
from .bindings import Security, CoreFoundation, CFConst
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# This regular expression is used to grab PEM data out of a PEM bundle.
|
|
22
|
+
_PEM_CERTS_RE = re.compile(
|
|
23
|
+
b"-----BEGIN CERTIFICATE-----\n(.*?)\n-----END CERTIFICATE-----", re.DOTALL
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _cf_data_from_bytes(bytestring):
|
|
28
|
+
"""
|
|
29
|
+
Given a bytestring, create a CFData object from it. This CFData object must
|
|
30
|
+
be CFReleased by the caller.
|
|
31
|
+
"""
|
|
32
|
+
return CoreFoundation.CFDataCreate(
|
|
33
|
+
CoreFoundation.kCFAllocatorDefault, bytestring, len(bytestring)
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _cf_dictionary_from_tuples(tuples):
|
|
38
|
+
"""
|
|
39
|
+
Given a list of Python tuples, create an associated CFDictionary.
|
|
40
|
+
"""
|
|
41
|
+
dictionary_size = len(tuples)
|
|
42
|
+
|
|
43
|
+
# We need to get the dictionary keys and values out in the same order.
|
|
44
|
+
keys = (t[0] for t in tuples)
|
|
45
|
+
values = (t[1] for t in tuples)
|
|
46
|
+
cf_keys = (CoreFoundation.CFTypeRef * dictionary_size)(*keys)
|
|
47
|
+
cf_values = (CoreFoundation.CFTypeRef * dictionary_size)(*values)
|
|
48
|
+
|
|
49
|
+
return CoreFoundation.CFDictionaryCreate(
|
|
50
|
+
CoreFoundation.kCFAllocatorDefault,
|
|
51
|
+
cf_keys,
|
|
52
|
+
cf_values,
|
|
53
|
+
dictionary_size,
|
|
54
|
+
CoreFoundation.kCFTypeDictionaryKeyCallBacks,
|
|
55
|
+
CoreFoundation.kCFTypeDictionaryValueCallBacks,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _cf_string_to_unicode(value):
|
|
60
|
+
"""
|
|
61
|
+
Creates a Unicode string from a CFString object. Used entirely for error
|
|
62
|
+
reporting.
|
|
63
|
+
|
|
64
|
+
Yes, it annoys me quite a lot that this function is this complex.
|
|
65
|
+
"""
|
|
66
|
+
value_as_void_p = ctypes.cast(value, ctypes.POINTER(ctypes.c_void_p))
|
|
67
|
+
|
|
68
|
+
string = CoreFoundation.CFStringGetCStringPtr(
|
|
69
|
+
value_as_void_p,
|
|
70
|
+
CFConst.kCFStringEncodingUTF8
|
|
71
|
+
)
|
|
72
|
+
if string is None:
|
|
73
|
+
buffer = ctypes.create_string_buffer(1024)
|
|
74
|
+
result = CoreFoundation.CFStringGetCString(
|
|
75
|
+
value_as_void_p,
|
|
76
|
+
buffer,
|
|
77
|
+
1024,
|
|
78
|
+
CFConst.kCFStringEncodingUTF8
|
|
79
|
+
)
|
|
80
|
+
if not result:
|
|
81
|
+
raise OSError('Error copying C string from CFStringRef')
|
|
82
|
+
string = buffer.value
|
|
83
|
+
if string is not None:
|
|
84
|
+
string = string.decode('utf-8')
|
|
85
|
+
return string
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def _assert_no_error(error, exception_class=None):
|
|
89
|
+
"""
|
|
90
|
+
Checks the return code and throws an exception if there is an error to
|
|
91
|
+
report
|
|
92
|
+
"""
|
|
93
|
+
if error == 0:
|
|
94
|
+
return
|
|
95
|
+
|
|
96
|
+
cf_error_string = Security.SecCopyErrorMessageString(error, None)
|
|
97
|
+
output = _cf_string_to_unicode(cf_error_string)
|
|
98
|
+
CoreFoundation.CFRelease(cf_error_string)
|
|
99
|
+
|
|
100
|
+
if output is None or output == u'':
|
|
101
|
+
output = u'OSStatus %s' % error
|
|
102
|
+
|
|
103
|
+
if exception_class is None:
|
|
104
|
+
exception_class = ssl.SSLError
|
|
105
|
+
|
|
106
|
+
raise exception_class(output)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _cert_array_from_pem(pem_bundle):
|
|
110
|
+
"""
|
|
111
|
+
Given a bundle of certs in PEM format, turns them into a CFArray of certs
|
|
112
|
+
that can be used to validate a cert chain.
|
|
113
|
+
"""
|
|
114
|
+
der_certs = [
|
|
115
|
+
base64.b64decode(match.group(1))
|
|
116
|
+
for match in _PEM_CERTS_RE.finditer(pem_bundle)
|
|
117
|
+
]
|
|
118
|
+
if not der_certs:
|
|
119
|
+
raise ssl.SSLError("No root certificates specified")
|
|
120
|
+
|
|
121
|
+
cert_array = CoreFoundation.CFArrayCreateMutable(
|
|
122
|
+
CoreFoundation.kCFAllocatorDefault,
|
|
123
|
+
0,
|
|
124
|
+
ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks)
|
|
125
|
+
)
|
|
126
|
+
if not cert_array:
|
|
127
|
+
raise ssl.SSLError("Unable to allocate memory!")
|
|
128
|
+
|
|
129
|
+
try:
|
|
130
|
+
for der_bytes in der_certs:
|
|
131
|
+
certdata = _cf_data_from_bytes(der_bytes)
|
|
132
|
+
if not certdata:
|
|
133
|
+
raise ssl.SSLError("Unable to allocate memory!")
|
|
134
|
+
cert = Security.SecCertificateCreateWithData(
|
|
135
|
+
CoreFoundation.kCFAllocatorDefault, certdata
|
|
136
|
+
)
|
|
137
|
+
CoreFoundation.CFRelease(certdata)
|
|
138
|
+
if not cert:
|
|
139
|
+
raise ssl.SSLError("Unable to build cert object!")
|
|
140
|
+
|
|
141
|
+
CoreFoundation.CFArrayAppendValue(cert_array, cert)
|
|
142
|
+
CoreFoundation.CFRelease(cert)
|
|
143
|
+
except Exception:
|
|
144
|
+
# We need to free the array before the exception bubbles further.
|
|
145
|
+
# We only want to do that if an error occurs: otherwise, the caller
|
|
146
|
+
# should free.
|
|
147
|
+
CoreFoundation.CFRelease(cert_array)
|
|
148
|
+
|
|
149
|
+
return cert_array
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def _is_cert(item):
|
|
153
|
+
"""
|
|
154
|
+
Returns True if a given CFTypeRef is a certificate.
|
|
155
|
+
"""
|
|
156
|
+
expected = Security.SecCertificateGetTypeID()
|
|
157
|
+
return CoreFoundation.CFGetTypeID(item) == expected
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def _is_identity(item):
|
|
161
|
+
"""
|
|
162
|
+
Returns True if a given CFTypeRef is an identity.
|
|
163
|
+
"""
|
|
164
|
+
expected = Security.SecIdentityGetTypeID()
|
|
165
|
+
return CoreFoundation.CFGetTypeID(item) == expected
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def _temporary_keychain():
|
|
169
|
+
"""
|
|
170
|
+
This function creates a temporary Mac keychain that we can use to work with
|
|
171
|
+
credentials. This keychain uses a one-time password and a temporary file to
|
|
172
|
+
store the data. We expect to have one keychain per socket. The returned
|
|
173
|
+
SecKeychainRef must be freed by the caller, including calling
|
|
174
|
+
SecKeychainDelete.
|
|
175
|
+
|
|
176
|
+
Returns a tuple of the SecKeychainRef and the path to the temporary
|
|
177
|
+
directory that contains it.
|
|
178
|
+
"""
|
|
179
|
+
# Unfortunately, SecKeychainCreate requires a path to a keychain. This
|
|
180
|
+
# means we cannot use mkstemp to use a generic temporary file. Instead,
|
|
181
|
+
# we're going to create a temporary directory and a filename to use there.
|
|
182
|
+
# This filename will be 8 random bytes expanded into base64. We also need
|
|
183
|
+
# some random bytes to password-protect the keychain we're creating, so we
|
|
184
|
+
# ask for 40 random bytes.
|
|
185
|
+
random_bytes = os.urandom(40)
|
|
186
|
+
filename = base64.b64encode(random_bytes[:8]).decode('utf-8')
|
|
187
|
+
password = base64.b64encode(random_bytes[8:]) # Must be valid UTF-8
|
|
188
|
+
tempdirectory = tempfile.mkdtemp()
|
|
189
|
+
|
|
190
|
+
keychain_path = os.path.join(tempdirectory, filename).encode('utf-8')
|
|
191
|
+
|
|
192
|
+
# We now want to create the keychain itself.
|
|
193
|
+
keychain = Security.SecKeychainRef()
|
|
194
|
+
status = Security.SecKeychainCreate(
|
|
195
|
+
keychain_path,
|
|
196
|
+
len(password),
|
|
197
|
+
password,
|
|
198
|
+
False,
|
|
199
|
+
None,
|
|
200
|
+
ctypes.byref(keychain)
|
|
201
|
+
)
|
|
202
|
+
_assert_no_error(status)
|
|
203
|
+
|
|
204
|
+
# Having created the keychain, we want to pass it off to the caller.
|
|
205
|
+
return keychain, tempdirectory
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def _load_items_from_file(keychain, path):
|
|
209
|
+
"""
|
|
210
|
+
Given a single file, loads all the trust objects from it into arrays and
|
|
211
|
+
the keychain.
|
|
212
|
+
Returns a tuple of lists: the first list is a list of identities, the
|
|
213
|
+
second a list of certs.
|
|
214
|
+
"""
|
|
215
|
+
certificates = []
|
|
216
|
+
identities = []
|
|
217
|
+
result_array = None
|
|
218
|
+
|
|
219
|
+
with open(path, 'rb') as f:
|
|
220
|
+
raw_filedata = f.read()
|
|
221
|
+
|
|
222
|
+
try:
|
|
223
|
+
filedata = CoreFoundation.CFDataCreate(
|
|
224
|
+
CoreFoundation.kCFAllocatorDefault,
|
|
225
|
+
raw_filedata,
|
|
226
|
+
len(raw_filedata)
|
|
227
|
+
)
|
|
228
|
+
result_array = CoreFoundation.CFArrayRef()
|
|
229
|
+
result = Security.SecItemImport(
|
|
230
|
+
filedata, # cert data
|
|
231
|
+
None, # Filename, leaving it out for now
|
|
232
|
+
None, # What the type of the file is, we don't care
|
|
233
|
+
None, # what's in the file, we don't care
|
|
234
|
+
0, # import flags
|
|
235
|
+
None, # key params, can include passphrase in the future
|
|
236
|
+
keychain, # The keychain to insert into
|
|
237
|
+
ctypes.byref(result_array) # Results
|
|
238
|
+
)
|
|
239
|
+
_assert_no_error(result)
|
|
240
|
+
|
|
241
|
+
# A CFArray is not very useful to us as an intermediary
|
|
242
|
+
# representation, so we are going to extract the objects we want
|
|
243
|
+
# and then free the array. We don't need to keep hold of keys: the
|
|
244
|
+
# keychain already has them!
|
|
245
|
+
result_count = CoreFoundation.CFArrayGetCount(result_array)
|
|
246
|
+
for index in range(result_count):
|
|
247
|
+
item = CoreFoundation.CFArrayGetValueAtIndex(
|
|
248
|
+
result_array, index
|
|
249
|
+
)
|
|
250
|
+
item = ctypes.cast(item, CoreFoundation.CFTypeRef)
|
|
251
|
+
|
|
252
|
+
if _is_cert(item):
|
|
253
|
+
CoreFoundation.CFRetain(item)
|
|
254
|
+
certificates.append(item)
|
|
255
|
+
elif _is_identity(item):
|
|
256
|
+
CoreFoundation.CFRetain(item)
|
|
257
|
+
identities.append(item)
|
|
258
|
+
finally:
|
|
259
|
+
if result_array:
|
|
260
|
+
CoreFoundation.CFRelease(result_array)
|
|
261
|
+
|
|
262
|
+
CoreFoundation.CFRelease(filedata)
|
|
263
|
+
|
|
264
|
+
return (identities, certificates)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
def _load_client_cert_chain(keychain, *paths):
|
|
268
|
+
"""
|
|
269
|
+
Load certificates and maybe keys from a number of files. Has the end goal
|
|
270
|
+
of returning a CFArray containing one SecIdentityRef, and then zero or more
|
|
271
|
+
SecCertificateRef objects, suitable for use as a client certificate trust
|
|
272
|
+
chain.
|
|
273
|
+
"""
|
|
274
|
+
# Ok, the strategy.
|
|
275
|
+
#
|
|
276
|
+
# This relies on knowing that macOS will not give you a SecIdentityRef
|
|
277
|
+
# unless you have imported a key into a keychain. This is a somewhat
|
|
278
|
+
# artificial limitation of macOS (for example, it doesn't necessarily
|
|
279
|
+
# affect iOS), but there is nothing inside Security.framework that lets you
|
|
280
|
+
# get a SecIdentityRef without having a key in a keychain.
|
|
281
|
+
#
|
|
282
|
+
# So the policy here is we take all the files and iterate them in order.
|
|
283
|
+
# Each one will use SecItemImport to have one or more objects loaded from
|
|
284
|
+
# it. We will also point at a keychain that macOS can use to work with the
|
|
285
|
+
# private key.
|
|
286
|
+
#
|
|
287
|
+
# Once we have all the objects, we'll check what we actually have. If we
|
|
288
|
+
# already have a SecIdentityRef in hand, fab: we'll use that. Otherwise,
|
|
289
|
+
# we'll take the first certificate (which we assume to be our leaf) and
|
|
290
|
+
# ask the keychain to give us a SecIdentityRef with that cert's associated
|
|
291
|
+
# key.
|
|
292
|
+
#
|
|
293
|
+
# We'll then return a CFArray containing the trust chain: one
|
|
294
|
+
# SecIdentityRef and then zero-or-more SecCertificateRef objects. The
|
|
295
|
+
# responsibility for freeing this CFArray will be with the caller. This
|
|
296
|
+
# CFArray must remain alive for the entire connection, so in practice it
|
|
297
|
+
# will be stored with a single SSLSocket, along with the reference to the
|
|
298
|
+
# keychain.
|
|
299
|
+
certificates = []
|
|
300
|
+
identities = []
|
|
301
|
+
|
|
302
|
+
# Filter out bad paths.
|
|
303
|
+
paths = (path for path in paths if path)
|
|
304
|
+
|
|
305
|
+
try:
|
|
306
|
+
for file_path in paths:
|
|
307
|
+
new_identities, new_certs = _load_items_from_file(
|
|
308
|
+
keychain, file_path
|
|
309
|
+
)
|
|
310
|
+
identities.extend(new_identities)
|
|
311
|
+
certificates.extend(new_certs)
|
|
312
|
+
|
|
313
|
+
# Ok, we have everything. The question is: do we have an identity? If
|
|
314
|
+
# not, we want to grab one from the first cert we have.
|
|
315
|
+
if not identities:
|
|
316
|
+
new_identity = Security.SecIdentityRef()
|
|
317
|
+
status = Security.SecIdentityCreateWithCertificate(
|
|
318
|
+
keychain,
|
|
319
|
+
certificates[0],
|
|
320
|
+
ctypes.byref(new_identity)
|
|
321
|
+
)
|
|
322
|
+
_assert_no_error(status)
|
|
323
|
+
identities.append(new_identity)
|
|
324
|
+
|
|
325
|
+
# We now want to release the original certificate, as we no longer
|
|
326
|
+
# need it.
|
|
327
|
+
CoreFoundation.CFRelease(certificates.pop(0))
|
|
328
|
+
|
|
329
|
+
# We now need to build a new CFArray that holds the trust chain.
|
|
330
|
+
trust_chain = CoreFoundation.CFArrayCreateMutable(
|
|
331
|
+
CoreFoundation.kCFAllocatorDefault,
|
|
332
|
+
0,
|
|
333
|
+
ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks),
|
|
334
|
+
)
|
|
335
|
+
for item in itertools.chain(identities, certificates):
|
|
336
|
+
# ArrayAppendValue does a CFRetain on the item. That's fine,
|
|
337
|
+
# because the finally block will release our other refs to them.
|
|
338
|
+
CoreFoundation.CFArrayAppendValue(trust_chain, item)
|
|
339
|
+
|
|
340
|
+
return trust_chain
|
|
341
|
+
finally:
|
|
342
|
+
for obj in itertools.chain(identities, certificates):
|
|
343
|
+
CoreFoundation.CFRelease(obj)
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module provides a pool manager that uses Google App Engine's
|
|
3
|
+
`URLFetch Service <https://cloud.google.com/appengine/docs/python/urlfetch>`_.
|
|
4
|
+
|
|
5
|
+
Example usage::
|
|
6
|
+
|
|
7
|
+
from pip._vendor.urllib3 import PoolManager
|
|
8
|
+
from pip._vendor.urllib3.contrib.appengine import AppEngineManager, is_appengine_sandbox
|
|
9
|
+
|
|
10
|
+
if is_appengine_sandbox():
|
|
11
|
+
# AppEngineManager uses AppEngine's URLFetch API behind the scenes
|
|
12
|
+
http = AppEngineManager()
|
|
13
|
+
else:
|
|
14
|
+
# PoolManager uses a socket-level API behind the scenes
|
|
15
|
+
http = PoolManager()
|
|
16
|
+
|
|
17
|
+
r = http.request('GET', 'https://google.com/')
|
|
18
|
+
|
|
19
|
+
There are `limitations <https://cloud.google.com/appengine/docs/python/\
|
|
20
|
+
urlfetch/#Python_Quotas_and_limits>`_ to the URLFetch service and it may not be
|
|
21
|
+
the best choice for your application. There are three options for using
|
|
22
|
+
urllib3 on Google App Engine:
|
|
23
|
+
|
|
24
|
+
1. You can use :class:`AppEngineManager` with URLFetch. URLFetch is
|
|
25
|
+
cost-effective in many circumstances as long as your usage is within the
|
|
26
|
+
limitations.
|
|
27
|
+
2. You can use a normal :class:`~urllib3.PoolManager` by enabling sockets.
|
|
28
|
+
Sockets also have `limitations and restrictions
|
|
29
|
+
<https://cloud.google.com/appengine/docs/python/sockets/\
|
|
30
|
+
#limitations-and-restrictions>`_ and have a lower free quota than URLFetch.
|
|
31
|
+
To use sockets, be sure to specify the following in your ``app.yaml``::
|
|
32
|
+
|
|
33
|
+
env_variables:
|
|
34
|
+
GAE_USE_SOCKETS_HTTPLIB : 'true'
|
|
35
|
+
|
|
36
|
+
3. If you are using `App Engine Flexible
|
|
37
|
+
<https://cloud.google.com/appengine/docs/flexible/>`_, you can use the standard
|
|
38
|
+
:class:`PoolManager` without any configuration or special environment variables.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
from __future__ import absolute_import
|
|
42
|
+
import logging
|
|
43
|
+
import os
|
|
44
|
+
import warnings
|
|
45
|
+
from ..packages.six.moves.urllib.parse import urljoin
|
|
46
|
+
|
|
47
|
+
from ..exceptions import (
|
|
48
|
+
HTTPError,
|
|
49
|
+
HTTPWarning,
|
|
50
|
+
MaxRetryError,
|
|
51
|
+
ProtocolError,
|
|
52
|
+
TimeoutError,
|
|
53
|
+
SSLError
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
from ..packages.six import BytesIO
|
|
57
|
+
from ..request import RequestMethods
|
|
58
|
+
from ..response import HTTPResponse
|
|
59
|
+
from ..util.timeout import Timeout
|
|
60
|
+
from ..util.retry import Retry
|
|
61
|
+
|
|
62
|
+
try:
|
|
63
|
+
from google.appengine.api import urlfetch
|
|
64
|
+
except ImportError:
|
|
65
|
+
urlfetch = None
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
log = logging.getLogger(__name__)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class AppEnginePlatformWarning(HTTPWarning):
|
|
72
|
+
pass
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class AppEnginePlatformError(HTTPError):
|
|
76
|
+
pass
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class AppEngineManager(RequestMethods):
|
|
80
|
+
"""
|
|
81
|
+
Connection manager for Google App Engine sandbox applications.
|
|
82
|
+
|
|
83
|
+
This manager uses the URLFetch service directly instead of using the
|
|
84
|
+
emulated httplib, and is subject to URLFetch limitations as described in
|
|
85
|
+
the App Engine documentation `here
|
|
86
|
+
<https://cloud.google.com/appengine/docs/python/urlfetch>`_.
|
|
87
|
+
|
|
88
|
+
Notably it will raise an :class:`AppEnginePlatformError` if:
|
|
89
|
+
* URLFetch is not available.
|
|
90
|
+
* If you attempt to use this on App Engine Flexible, as full socket
|
|
91
|
+
support is available.
|
|
92
|
+
* If a request size is more than 10 megabytes.
|
|
93
|
+
* If a response size is more than 32 megabtyes.
|
|
94
|
+
* If you use an unsupported request method such as OPTIONS.
|
|
95
|
+
|
|
96
|
+
Beyond those cases, it will raise normal urllib3 errors.
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
def __init__(self, headers=None, retries=None, validate_certificate=True,
|
|
100
|
+
urlfetch_retries=True):
|
|
101
|
+
if not urlfetch:
|
|
102
|
+
raise AppEnginePlatformError(
|
|
103
|
+
"URLFetch is not available in this environment.")
|
|
104
|
+
|
|
105
|
+
if is_prod_appengine_mvms():
|
|
106
|
+
raise AppEnginePlatformError(
|
|
107
|
+
"Use normal urllib3.PoolManager instead of AppEngineManager"
|
|
108
|
+
"on Managed VMs, as using URLFetch is not necessary in "
|
|
109
|
+
"this environment.")
|
|
110
|
+
|
|
111
|
+
warnings.warn(
|
|
112
|
+
"urllib3 is using URLFetch on Google App Engine sandbox instead "
|
|
113
|
+
"of sockets. To use sockets directly instead of URLFetch see "
|
|
114
|
+
"https://urllib3.readthedocs.io/en/latest/reference/urllib3.contrib.html.",
|
|
115
|
+
AppEnginePlatformWarning)
|
|
116
|
+
|
|
117
|
+
RequestMethods.__init__(self, headers)
|
|
118
|
+
self.validate_certificate = validate_certificate
|
|
119
|
+
self.urlfetch_retries = urlfetch_retries
|
|
120
|
+
|
|
121
|
+
self.retries = retries or Retry.DEFAULT
|
|
122
|
+
|
|
123
|
+
def __enter__(self):
|
|
124
|
+
return self
|
|
125
|
+
|
|
126
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
127
|
+
# Return False to re-raise any potential exceptions
|
|
128
|
+
return False
|
|
129
|
+
|
|
130
|
+
def urlopen(self, method, url, body=None, headers=None,
|
|
131
|
+
retries=None, redirect=True, timeout=Timeout.DEFAULT_TIMEOUT,
|
|
132
|
+
**response_kw):
|
|
133
|
+
|
|
134
|
+
retries = self._get_retries(retries, redirect)
|
|
135
|
+
|
|
136
|
+
try:
|
|
137
|
+
follow_redirects = (
|
|
138
|
+
redirect and
|
|
139
|
+
retries.redirect != 0 and
|
|
140
|
+
retries.total)
|
|
141
|
+
response = urlfetch.fetch(
|
|
142
|
+
url,
|
|
143
|
+
payload=body,
|
|
144
|
+
method=method,
|
|
145
|
+
headers=headers or {},
|
|
146
|
+
allow_truncated=False,
|
|
147
|
+
follow_redirects=self.urlfetch_retries and follow_redirects,
|
|
148
|
+
deadline=self._get_absolute_timeout(timeout),
|
|
149
|
+
validate_certificate=self.validate_certificate,
|
|
150
|
+
)
|
|
151
|
+
except urlfetch.DeadlineExceededError as e:
|
|
152
|
+
raise TimeoutError(self, e)
|
|
153
|
+
|
|
154
|
+
except urlfetch.InvalidURLError as e:
|
|
155
|
+
if 'too large' in str(e):
|
|
156
|
+
raise AppEnginePlatformError(
|
|
157
|
+
"URLFetch request too large, URLFetch only "
|
|
158
|
+
"supports requests up to 10mb in size.", e)
|
|
159
|
+
raise ProtocolError(e)
|
|
160
|
+
|
|
161
|
+
except urlfetch.DownloadError as e:
|
|
162
|
+
if 'Too many redirects' in str(e):
|
|
163
|
+
raise MaxRetryError(self, url, reason=e)
|
|
164
|
+
raise ProtocolError(e)
|
|
165
|
+
|
|
166
|
+
except urlfetch.ResponseTooLargeError as e:
|
|
167
|
+
raise AppEnginePlatformError(
|
|
168
|
+
"URLFetch response too large, URLFetch only supports"
|
|
169
|
+
"responses up to 32mb in size.", e)
|
|
170
|
+
|
|
171
|
+
except urlfetch.SSLCertificateError as e:
|
|
172
|
+
raise SSLError(e)
|
|
173
|
+
|
|
174
|
+
except urlfetch.InvalidMethodError as e:
|
|
175
|
+
raise AppEnginePlatformError(
|
|
176
|
+
"URLFetch does not support method: %s" % method, e)
|
|
177
|
+
|
|
178
|
+
http_response = self._urlfetch_response_to_http_response(
|
|
179
|
+
response, retries=retries, **response_kw)
|
|
180
|
+
|
|
181
|
+
# Handle redirect?
|
|
182
|
+
redirect_location = redirect and http_response.get_redirect_location()
|
|
183
|
+
if redirect_location:
|
|
184
|
+
# Check for redirect response
|
|
185
|
+
if (self.urlfetch_retries and retries.raise_on_redirect):
|
|
186
|
+
raise MaxRetryError(self, url, "too many redirects")
|
|
187
|
+
else:
|
|
188
|
+
if http_response.status == 303:
|
|
189
|
+
method = 'GET'
|
|
190
|
+
|
|
191
|
+
try:
|
|
192
|
+
retries = retries.increment(method, url, response=http_response, _pool=self)
|
|
193
|
+
except MaxRetryError:
|
|
194
|
+
if retries.raise_on_redirect:
|
|
195
|
+
raise MaxRetryError(self, url, "too many redirects")
|
|
196
|
+
return http_response
|
|
197
|
+
|
|
198
|
+
retries.sleep_for_retry(http_response)
|
|
199
|
+
log.debug("Redirecting %s -> %s", url, redirect_location)
|
|
200
|
+
redirect_url = urljoin(url, redirect_location)
|
|
201
|
+
return self.urlopen(
|
|
202
|
+
method, redirect_url, body, headers,
|
|
203
|
+
retries=retries, redirect=redirect,
|
|
204
|
+
timeout=timeout, **response_kw)
|
|
205
|
+
|
|
206
|
+
# Check if we should retry the HTTP response.
|
|
207
|
+
has_retry_after = bool(http_response.getheader('Retry-After'))
|
|
208
|
+
if retries.is_retry(method, http_response.status, has_retry_after):
|
|
209
|
+
retries = retries.increment(
|
|
210
|
+
method, url, response=http_response, _pool=self)
|
|
211
|
+
log.debug("Retry: %s", url)
|
|
212
|
+
retries.sleep(http_response)
|
|
213
|
+
return self.urlopen(
|
|
214
|
+
method, url,
|
|
215
|
+
body=body, headers=headers,
|
|
216
|
+
retries=retries, redirect=redirect,
|
|
217
|
+
timeout=timeout, **response_kw)
|
|
218
|
+
|
|
219
|
+
return http_response
|
|
220
|
+
|
|
221
|
+
def _urlfetch_response_to_http_response(self, urlfetch_resp, **response_kw):
|
|
222
|
+
|
|
223
|
+
if is_prod_appengine():
|
|
224
|
+
# Production GAE handles deflate encoding automatically, but does
|
|
225
|
+
# not remove the encoding header.
|
|
226
|
+
content_encoding = urlfetch_resp.headers.get('content-encoding')
|
|
227
|
+
|
|
228
|
+
if content_encoding == 'deflate':
|
|
229
|
+
del urlfetch_resp.headers['content-encoding']
|
|
230
|
+
|
|
231
|
+
transfer_encoding = urlfetch_resp.headers.get('transfer-encoding')
|
|
232
|
+
# We have a full response's content,
|
|
233
|
+
# so let's make sure we don't report ourselves as chunked data.
|
|
234
|
+
if transfer_encoding == 'chunked':
|
|
235
|
+
encodings = transfer_encoding.split(",")
|
|
236
|
+
encodings.remove('chunked')
|
|
237
|
+
urlfetch_resp.headers['transfer-encoding'] = ','.join(encodings)
|
|
238
|
+
|
|
239
|
+
return HTTPResponse(
|
|
240
|
+
# In order for decoding to work, we must present the content as
|
|
241
|
+
# a file-like object.
|
|
242
|
+
body=BytesIO(urlfetch_resp.content),
|
|
243
|
+
headers=urlfetch_resp.headers,
|
|
244
|
+
status=urlfetch_resp.status_code,
|
|
245
|
+
**response_kw
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
def _get_absolute_timeout(self, timeout):
|
|
249
|
+
if timeout is Timeout.DEFAULT_TIMEOUT:
|
|
250
|
+
return None # Defer to URLFetch's default.
|
|
251
|
+
if isinstance(timeout, Timeout):
|
|
252
|
+
if timeout._read is not None or timeout._connect is not None:
|
|
253
|
+
warnings.warn(
|
|
254
|
+
"URLFetch does not support granular timeout settings, "
|
|
255
|
+
"reverting to total or default URLFetch timeout.",
|
|
256
|
+
AppEnginePlatformWarning)
|
|
257
|
+
return timeout.total
|
|
258
|
+
return timeout
|
|
259
|
+
|
|
260
|
+
def _get_retries(self, retries, redirect):
|
|
261
|
+
if not isinstance(retries, Retry):
|
|
262
|
+
retries = Retry.from_int(
|
|
263
|
+
retries, redirect=redirect, default=self.retries)
|
|
264
|
+
|
|
265
|
+
if retries.connect or retries.read or retries.redirect:
|
|
266
|
+
warnings.warn(
|
|
267
|
+
"URLFetch only supports total retries and does not "
|
|
268
|
+
"recognize connect, read, or redirect retry parameters.",
|
|
269
|
+
AppEnginePlatformWarning)
|
|
270
|
+
|
|
271
|
+
return retries
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def is_appengine():
|
|
275
|
+
return (is_local_appengine() or
|
|
276
|
+
is_prod_appengine() or
|
|
277
|
+
is_prod_appengine_mvms())
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def is_appengine_sandbox():
|
|
281
|
+
return is_appengine() and not is_prod_appengine_mvms()
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def is_local_appengine():
|
|
285
|
+
return ('APPENGINE_RUNTIME' in os.environ and
|
|
286
|
+
'Development/' in os.environ['SERVER_SOFTWARE'])
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
def is_prod_appengine():
|
|
290
|
+
return ('APPENGINE_RUNTIME' in os.environ and
|
|
291
|
+
'Google App Engine/' in os.environ['SERVER_SOFTWARE'] and
|
|
292
|
+
not is_prod_appengine_mvms())
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def is_prod_appengine_mvms():
|
|
296
|
+
return os.environ.get('GAE_VM', False) == 'true'
|