rigid 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/rigid +4 -0
- data/rigid +16 -0
- data/vendor/PyYAML-3.12.dist-info/DESCRIPTION.rst +12 -0
- data/vendor/PyYAML-3.12.dist-info/INSTALLER +1 -0
- data/vendor/PyYAML-3.12.dist-info/METADATA +35 -0
- data/vendor/PyYAML-3.12.dist-info/RECORD +42 -0
- data/vendor/PyYAML-3.12.dist-info/WHEEL +5 -0
- data/vendor/PyYAML-3.12.dist-info/metadata.json +1 -0
- data/vendor/PyYAML-3.12.dist-info/top_level.txt +2 -0
- data/vendor/_yaml.so +0 -0
- data/vendor/click/__init__.py +98 -0
- data/vendor/click/__init__.pyc +0 -0
- data/vendor/click/_bashcomplete.py +83 -0
- data/vendor/click/_bashcomplete.pyc +0 -0
- data/vendor/click/_compat.py +642 -0
- data/vendor/click/_compat.pyc +0 -0
- data/vendor/click/_termui_impl.py +547 -0
- data/vendor/click/_termui_impl.pyc +0 -0
- data/vendor/click/_textwrap.py +38 -0
- data/vendor/click/_textwrap.pyc +0 -0
- data/vendor/click/_unicodefun.py +119 -0
- data/vendor/click/_unicodefun.pyc +0 -0
- data/vendor/click/_winconsole.py +273 -0
- data/vendor/click/_winconsole.pyc +0 -0
- data/vendor/click/core.py +1738 -0
- data/vendor/click/core.pyc +0 -0
- data/vendor/click/decorators.py +304 -0
- data/vendor/click/decorators.pyc +0 -0
- data/vendor/click/exceptions.py +201 -0
- data/vendor/click/exceptions.pyc +0 -0
- data/vendor/click/formatting.py +256 -0
- data/vendor/click/formatting.pyc +0 -0
- data/vendor/click/globals.py +48 -0
- data/vendor/click/globals.pyc +0 -0
- data/vendor/click/parser.py +426 -0
- data/vendor/click/parser.pyc +0 -0
- data/vendor/click/termui.py +539 -0
- data/vendor/click/termui.pyc +0 -0
- data/vendor/click/testing.py +322 -0
- data/vendor/click/testing.pyc +0 -0
- data/vendor/click/types.py +550 -0
- data/vendor/click/types.pyc +0 -0
- data/vendor/click/utils.py +415 -0
- data/vendor/click/utils.pyc +0 -0
- data/vendor/click-6.6.dist-info/DESCRIPTION.rst +3 -0
- data/vendor/click-6.6.dist-info/INSTALLER +1 -0
- data/vendor/click-6.6.dist-info/METADATA +16 -0
- data/vendor/click-6.6.dist-info/RECORD +41 -0
- data/vendor/click-6.6.dist-info/WHEEL +6 -0
- data/vendor/click-6.6.dist-info/metadata.json +1 -0
- data/vendor/click-6.6.dist-info/top_level.txt +1 -0
- data/vendor/easy_install.py +5 -0
- data/vendor/easy_install.pyc +0 -0
- data/vendor/pip-9.0.1.dist-info/DESCRIPTION.rst +39 -0
- data/vendor/pip-9.0.1.dist-info/INSTALLER +1 -0
- data/vendor/pip-9.0.1.dist-info/METADATA +69 -0
- data/vendor/pip-9.0.1.dist-info/RECORD +501 -0
- data/vendor/pip-9.0.1.dist-info/WHEEL +6 -0
- data/vendor/pip-9.0.1.dist-info/entry_points.txt +5 -0
- data/vendor/pip-9.0.1.dist-info/metadata.json +1 -0
- data/vendor/pip-9.0.1.dist-info/top_level.txt +1 -0
- data/vendor/pkg_resources/__init__.py +3051 -0
- data/vendor/pkg_resources/__init__.pyc +0 -0
- data/vendor/pkg_resources/_vendor/__init__.py +0 -0
- data/vendor/pkg_resources/_vendor/__init__.pyc +0 -0
- data/vendor/pkg_resources/_vendor/appdirs.py +552 -0
- data/vendor/pkg_resources/_vendor/appdirs.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/__about__.py +21 -0
- data/vendor/pkg_resources/_vendor/packaging/__about__.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/__init__.py +14 -0
- data/vendor/pkg_resources/_vendor/packaging/__init__.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/_compat.py +30 -0
- data/vendor/pkg_resources/_vendor/packaging/_compat.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/_structures.py +68 -0
- data/vendor/pkg_resources/_vendor/packaging/_structures.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/markers.py +287 -0
- data/vendor/pkg_resources/_vendor/packaging/markers.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/requirements.py +127 -0
- data/vendor/pkg_resources/_vendor/packaging/requirements.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/specifiers.py +774 -0
- data/vendor/pkg_resources/_vendor/packaging/specifiers.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/utils.py +14 -0
- data/vendor/pkg_resources/_vendor/packaging/utils.pyc +0 -0
- data/vendor/pkg_resources/_vendor/packaging/version.py +393 -0
- data/vendor/pkg_resources/_vendor/packaging/version.pyc +0 -0
- data/vendor/pkg_resources/_vendor/pyparsing.py +5696 -0
- data/vendor/pkg_resources/_vendor/pyparsing.pyc +0 -0
- data/vendor/pkg_resources/_vendor/six.py +868 -0
- data/vendor/pkg_resources/_vendor/six.pyc +0 -0
- data/vendor/pkg_resources/extern/__init__.py +73 -0
- data/vendor/pkg_resources/extern/__init__.pyc +0 -0
- data/vendor/requests/__init__.py +86 -0
- data/vendor/requests/__init__.pyc +0 -0
- data/vendor/requests/adapters.py +503 -0
- data/vendor/requests/adapters.pyc +0 -0
- data/vendor/requests/api.py +148 -0
- data/vendor/requests/api.pyc +0 -0
- data/vendor/requests/auth.py +252 -0
- data/vendor/requests/auth.pyc +0 -0
- data/vendor/requests/cacert.pem +5616 -0
- data/vendor/requests/certs.py +25 -0
- data/vendor/requests/certs.pyc +0 -0
- data/vendor/requests/compat.py +66 -0
- data/vendor/requests/compat.pyc +0 -0
- data/vendor/requests/cookies.py +540 -0
- data/vendor/requests/cookies.pyc +0 -0
- data/vendor/requests/exceptions.py +114 -0
- data/vendor/requests/exceptions.pyc +0 -0
- data/vendor/requests/hooks.py +34 -0
- data/vendor/requests/hooks.pyc +0 -0
- data/vendor/requests/models.py +873 -0
- data/vendor/requests/models.pyc +0 -0
- data/vendor/requests/packages/__init__.py +36 -0
- data/vendor/requests/packages/__init__.pyc +0 -0
- data/vendor/requests/packages/chardet/__init__.py +32 -0
- data/vendor/requests/packages/chardet/__init__.pyc +0 -0
- data/vendor/requests/packages/chardet/big5freq.py +925 -0
- data/vendor/requests/packages/chardet/big5freq.pyc +0 -0
- data/vendor/requests/packages/chardet/big5prober.py +42 -0
- data/vendor/requests/packages/chardet/big5prober.pyc +0 -0
- data/vendor/requests/packages/chardet/chardetect.py +80 -0
- data/vendor/requests/packages/chardet/chardetect.pyc +0 -0
- data/vendor/requests/packages/chardet/chardistribution.py +231 -0
- data/vendor/requests/packages/chardet/chardistribution.pyc +0 -0
- data/vendor/requests/packages/chardet/charsetgroupprober.py +106 -0
- data/vendor/requests/packages/chardet/charsetgroupprober.pyc +0 -0
- data/vendor/requests/packages/chardet/charsetprober.py +62 -0
- data/vendor/requests/packages/chardet/charsetprober.pyc +0 -0
- data/vendor/requests/packages/chardet/codingstatemachine.py +61 -0
- data/vendor/requests/packages/chardet/codingstatemachine.pyc +0 -0
- data/vendor/requests/packages/chardet/compat.py +34 -0
- data/vendor/requests/packages/chardet/compat.pyc +0 -0
- data/vendor/requests/packages/chardet/constants.py +39 -0
- data/vendor/requests/packages/chardet/constants.pyc +0 -0
- data/vendor/requests/packages/chardet/cp949prober.py +44 -0
- data/vendor/requests/packages/chardet/cp949prober.pyc +0 -0
- data/vendor/requests/packages/chardet/escprober.py +86 -0
- data/vendor/requests/packages/chardet/escprober.pyc +0 -0
- data/vendor/requests/packages/chardet/escsm.py +242 -0
- data/vendor/requests/packages/chardet/escsm.pyc +0 -0
- data/vendor/requests/packages/chardet/eucjpprober.py +90 -0
- data/vendor/requests/packages/chardet/eucjpprober.pyc +0 -0
- data/vendor/requests/packages/chardet/euckrfreq.py +596 -0
- data/vendor/requests/packages/chardet/euckrfreq.pyc +0 -0
- data/vendor/requests/packages/chardet/euckrprober.py +42 -0
- data/vendor/requests/packages/chardet/euckrprober.pyc +0 -0
- data/vendor/requests/packages/chardet/euctwfreq.py +428 -0
- data/vendor/requests/packages/chardet/euctwfreq.pyc +0 -0
- data/vendor/requests/packages/chardet/euctwprober.py +41 -0
- data/vendor/requests/packages/chardet/euctwprober.pyc +0 -0
- data/vendor/requests/packages/chardet/gb2312freq.py +472 -0
- data/vendor/requests/packages/chardet/gb2312freq.pyc +0 -0
- data/vendor/requests/packages/chardet/gb2312prober.py +41 -0
- data/vendor/requests/packages/chardet/gb2312prober.pyc +0 -0
- data/vendor/requests/packages/chardet/hebrewprober.py +283 -0
- data/vendor/requests/packages/chardet/hebrewprober.pyc +0 -0
- data/vendor/requests/packages/chardet/jisfreq.py +569 -0
- data/vendor/requests/packages/chardet/jisfreq.pyc +0 -0
- data/vendor/requests/packages/chardet/jpcntx.py +227 -0
- data/vendor/requests/packages/chardet/jpcntx.pyc +0 -0
- data/vendor/requests/packages/chardet/langbulgarianmodel.py +229 -0
- data/vendor/requests/packages/chardet/langbulgarianmodel.pyc +0 -0
- data/vendor/requests/packages/chardet/langcyrillicmodel.py +329 -0
- data/vendor/requests/packages/chardet/langcyrillicmodel.pyc +0 -0
- data/vendor/requests/packages/chardet/langgreekmodel.py +225 -0
- data/vendor/requests/packages/chardet/langgreekmodel.pyc +0 -0
- data/vendor/requests/packages/chardet/langhebrewmodel.py +201 -0
- data/vendor/requests/packages/chardet/langhebrewmodel.pyc +0 -0
- data/vendor/requests/packages/chardet/langhungarianmodel.py +225 -0
- data/vendor/requests/packages/chardet/langhungarianmodel.pyc +0 -0
- data/vendor/requests/packages/chardet/langthaimodel.py +200 -0
- data/vendor/requests/packages/chardet/langthaimodel.pyc +0 -0
- data/vendor/requests/packages/chardet/latin1prober.py +139 -0
- data/vendor/requests/packages/chardet/latin1prober.pyc +0 -0
- data/vendor/requests/packages/chardet/mbcharsetprober.py +86 -0
- data/vendor/requests/packages/chardet/mbcharsetprober.pyc +0 -0
- data/vendor/requests/packages/chardet/mbcsgroupprober.py +54 -0
- data/vendor/requests/packages/chardet/mbcsgroupprober.pyc +0 -0
- data/vendor/requests/packages/chardet/mbcssm.py +572 -0
- data/vendor/requests/packages/chardet/mbcssm.pyc +0 -0
- data/vendor/requests/packages/chardet/sbcharsetprober.py +120 -0
- data/vendor/requests/packages/chardet/sbcharsetprober.pyc +0 -0
- data/vendor/requests/packages/chardet/sbcsgroupprober.py +69 -0
- data/vendor/requests/packages/chardet/sbcsgroupprober.pyc +0 -0
- data/vendor/requests/packages/chardet/sjisprober.py +91 -0
- data/vendor/requests/packages/chardet/sjisprober.pyc +0 -0
- data/vendor/requests/packages/chardet/universaldetector.py +170 -0
- data/vendor/requests/packages/chardet/universaldetector.pyc +0 -0
- data/vendor/requests/packages/chardet/utf8prober.py +76 -0
- data/vendor/requests/packages/chardet/utf8prober.pyc +0 -0
- data/vendor/requests/packages/urllib3/__init__.py +96 -0
- data/vendor/requests/packages/urllib3/__init__.pyc +0 -0
- data/vendor/requests/packages/urllib3/_collections.py +324 -0
- data/vendor/requests/packages/urllib3/_collections.pyc +0 -0
- data/vendor/requests/packages/urllib3/connection.py +330 -0
- data/vendor/requests/packages/urllib3/connection.pyc +0 -0
- data/vendor/requests/packages/urllib3/connectionpool.py +866 -0
- data/vendor/requests/packages/urllib3/connectionpool.pyc +0 -0
- data/vendor/requests/packages/urllib3/contrib/__init__.py +0 -0
- data/vendor/requests/packages/urllib3/contrib/__init__.pyc +0 -0
- data/vendor/requests/packages/urllib3/contrib/appengine.py +231 -0
- data/vendor/requests/packages/urllib3/contrib/appengine.pyc +0 -0
- data/vendor/requests/packages/urllib3/contrib/ntlmpool.py +115 -0
- data/vendor/requests/packages/urllib3/contrib/ntlmpool.pyc +0 -0
- data/vendor/requests/packages/urllib3/contrib/pyopenssl.py +358 -0
- data/vendor/requests/packages/urllib3/contrib/pyopenssl.pyc +0 -0
- data/vendor/requests/packages/urllib3/contrib/socks.py +172 -0
- data/vendor/requests/packages/urllib3/contrib/socks.pyc +0 -0
- data/vendor/requests/packages/urllib3/exceptions.py +209 -0
- data/vendor/requests/packages/urllib3/exceptions.pyc +0 -0
- data/vendor/requests/packages/urllib3/fields.py +178 -0
- data/vendor/requests/packages/urllib3/fields.pyc +0 -0
- data/vendor/requests/packages/urllib3/filepost.py +94 -0
- data/vendor/requests/packages/urllib3/filepost.pyc +0 -0
- data/vendor/requests/packages/urllib3/packages/__init__.py +5 -0
- data/vendor/requests/packages/urllib3/packages/__init__.pyc +0 -0
- data/vendor/requests/packages/urllib3/packages/ordered_dict.py +259 -0
- data/vendor/requests/packages/urllib3/packages/ordered_dict.pyc +0 -0
- data/vendor/requests/packages/urllib3/packages/six.py +868 -0
- data/vendor/requests/packages/urllib3/packages/six.pyc +0 -0
- data/vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py +13 -0
- data/vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.pyc +0 -0
- data/vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py +105 -0
- data/vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.pyc +0 -0
- data/vendor/requests/packages/urllib3/poolmanager.py +367 -0
- data/vendor/requests/packages/urllib3/poolmanager.pyc +0 -0
- data/vendor/requests/packages/urllib3/request.py +151 -0
- data/vendor/requests/packages/urllib3/request.pyc +0 -0
- data/vendor/requests/packages/urllib3/response.py +530 -0
- data/vendor/requests/packages/urllib3/response.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/__init__.py +46 -0
- data/vendor/requests/packages/urllib3/util/__init__.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/connection.py +144 -0
- data/vendor/requests/packages/urllib3/util/connection.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/request.py +72 -0
- data/vendor/requests/packages/urllib3/util/request.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/response.py +74 -0
- data/vendor/requests/packages/urllib3/util/response.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/retry.py +300 -0
- data/vendor/requests/packages/urllib3/util/retry.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/ssl_.py +320 -0
- data/vendor/requests/packages/urllib3/util/ssl_.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/timeout.py +242 -0
- data/vendor/requests/packages/urllib3/util/timeout.pyc +0 -0
- data/vendor/requests/packages/urllib3/util/url.py +217 -0
- data/vendor/requests/packages/urllib3/util/url.pyc +0 -0
- data/vendor/requests/sessions.py +712 -0
- data/vendor/requests/sessions.pyc +0 -0
- data/vendor/requests/status_codes.py +91 -0
- data/vendor/requests/status_codes.pyc +0 -0
- data/vendor/requests/structures.py +105 -0
- data/vendor/requests/structures.pyc +0 -0
- data/vendor/requests/utils.py +817 -0
- data/vendor/requests/utils.pyc +0 -0
- data/vendor/requests-2.11.1.dist-info/DESCRIPTION.rst +1294 -0
- data/vendor/requests-2.11.1.dist-info/INSTALLER +1 -0
- data/vendor/requests-2.11.1.dist-info/METADATA +1323 -0
- data/vendor/requests-2.11.1.dist-info/RECORD +170 -0
- data/vendor/requests-2.11.1.dist-info/WHEEL +6 -0
- data/vendor/requests-2.11.1.dist-info/metadata.json +1 -0
- data/vendor/requests-2.11.1.dist-info/top_level.txt +1 -0
- data/vendor/rigid/__init__.py +1 -0
- data/vendor/rigid/__init__.pyc +0 -0
- data/vendor/rigid/api.py +129 -0
- data/vendor/rigid/api.pyc +0 -0
- data/vendor/rigid/commands/__init__.py +260 -0
- data/vendor/rigid/commands/__init__.pyc +0 -0
- data/vendor/rigid/commands/deploy.py +0 -0
- data/vendor/rigid/commands/deploy.pyc +0 -0
- data/vendor/rigid/deploy.py +70 -0
- data/vendor/rigid/deploy.pyc +0 -0
- data/vendor/rigid/file_scanner.py +63 -0
- data/vendor/rigid/file_scanner.pyc +0 -0
- data/vendor/rigid/utils.py +17 -0
- data/vendor/rigid/utils.pyc +0 -0
- data/vendor/rigid-0.2.0.dist-info/DESCRIPTION.rst +3 -0
- data/vendor/rigid-0.2.0.dist-info/INSTALLER +1 -0
- data/vendor/rigid-0.2.0.dist-info/METADATA +23 -0
- data/vendor/rigid-0.2.0.dist-info/RECORD +49 -0
- data/vendor/rigid-0.2.0.dist-info/WHEEL +5 -0
- data/vendor/rigid-0.2.0.dist-info/entry_points.txt +3 -0
- data/vendor/rigid-0.2.0.dist-info/metadata.json +1 -0
- data/vendor/rigid-0.2.0.dist-info/top_level.txt +2 -0
- data/vendor/setuptools-28.8.0.dist-info/DESCRIPTION.rst +243 -0
- data/vendor/setuptools-28.8.0.dist-info/INSTALLER +1 -0
- data/vendor/setuptools-28.8.0.dist-info/METADATA +272 -0
- data/vendor/setuptools-28.8.0.dist-info/RECORD +143 -0
- data/vendor/setuptools-28.8.0.dist-info/WHEEL +6 -0
- data/vendor/setuptools-28.8.0.dist-info/dependency_links.txt +2 -0
- data/vendor/setuptools-28.8.0.dist-info/entry_points.txt +63 -0
- data/vendor/setuptools-28.8.0.dist-info/metadata.json +1 -0
- data/vendor/setuptools-28.8.0.dist-info/top_level.txt +3 -0
- data/vendor/setuptools-28.8.0.dist-info/zip-safe +1 -0
- data/vendor/tests/__init__.py +0 -0
- data/vendor/tests/__init__.pyc +0 -0
- data/vendor/tests/integration/__init__.py +0 -0
- data/vendor/tests/integration/__init__.pyc +0 -0
- data/vendor/tests/integration/test_app.py +63 -0
- data/vendor/tests/integration/test_app.pyc +0 -0
- data/vendor/tests/integration/test_apps.py +27 -0
- data/vendor/tests/integration/test_apps.pyc +0 -0
- data/vendor/tests/integration/test_deploy.py +128 -0
- data/vendor/tests/integration/test_deploy.pyc +0 -0
- data/vendor/tests/integration/test_domains.py +35 -0
- data/vendor/tests/integration/test_domains.pyc +0 -0
- data/vendor/tests/integration/test_login.py +37 -0
- data/vendor/tests/integration/test_login.pyc +0 -0
- data/vendor/tests/integration/test_promote.py +24 -0
- data/vendor/tests/integration/test_promote.pyc +0 -0
- data/vendor/tests/integration/test_token.py +33 -0
- data/vendor/tests/integration/test_token.pyc +0 -0
- data/vendor/tests/integration/test_whoami.py +24 -0
- data/vendor/tests/integration/test_whoami.pyc +0 -0
- data/vendor/tests/test_deploy.py +33 -0
- data/vendor/tests/test_deploy.pyc +0 -0
- data/vendor/tests/test_file_scanner.py +89 -0
- data/vendor/tests/test_file_scanner.pyc +0 -0
- data/vendor/tests/utils.py +78 -0
- data/vendor/tests/utils.pyc +0 -0
- data/vendor/wheel-0.30.0a0.dist-info/DESCRIPTION.rst +325 -0
- data/vendor/wheel-0.30.0a0.dist-info/INSTALLER +1 -0
- data/vendor/wheel-0.30.0a0.dist-info/LICENSE.txt +22 -0
- data/vendor/wheel-0.30.0a0.dist-info/METADATA +357 -0
- data/vendor/wheel-0.30.0a0.dist-info/RECORD +86 -0
- data/vendor/wheel-0.30.0a0.dist-info/WHEEL +6 -0
- data/vendor/wheel-0.30.0a0.dist-info/entry_points.txt +6 -0
- data/vendor/wheel-0.30.0a0.dist-info/metadata.json +1 -0
- data/vendor/wheel-0.30.0a0.dist-info/top_level.txt +1 -0
- data/vendor/yaml/__init__.py +315 -0
- data/vendor/yaml/__init__.pyc +0 -0
- data/vendor/yaml/composer.py +139 -0
- data/vendor/yaml/composer.pyc +0 -0
- data/vendor/yaml/constructor.py +675 -0
- data/vendor/yaml/constructor.pyc +0 -0
- data/vendor/yaml/cyaml.py +85 -0
- data/vendor/yaml/cyaml.pyc +0 -0
- data/vendor/yaml/dumper.py +62 -0
- data/vendor/yaml/dumper.pyc +0 -0
- data/vendor/yaml/emitter.py +1140 -0
- data/vendor/yaml/emitter.pyc +0 -0
- data/vendor/yaml/error.py +75 -0
- data/vendor/yaml/error.pyc +0 -0
- data/vendor/yaml/events.py +86 -0
- data/vendor/yaml/events.pyc +0 -0
- data/vendor/yaml/loader.py +40 -0
- data/vendor/yaml/loader.pyc +0 -0
- data/vendor/yaml/nodes.py +49 -0
- data/vendor/yaml/nodes.pyc +0 -0
- data/vendor/yaml/parser.py +589 -0
- data/vendor/yaml/parser.pyc +0 -0
- data/vendor/yaml/reader.py +190 -0
- data/vendor/yaml/reader.pyc +0 -0
- data/vendor/yaml/representer.py +486 -0
- data/vendor/yaml/representer.pyc +0 -0
- data/vendor/yaml/resolver.py +227 -0
- data/vendor/yaml/resolver.pyc +0 -0
- data/vendor/yaml/scanner.py +1453 -0
- data/vendor/yaml/scanner.pyc +0 -0
- data/vendor/yaml/serializer.py +111 -0
- data/vendor/yaml/serializer.pyc +0 -0
- data/vendor/yaml/tokens.py +104 -0
- data/vendor/yaml/tokens.pyc +0 -0
- metadata +407 -0
@@ -0,0 +1,866 @@
|
|
1
|
+
from __future__ import absolute_import
|
2
|
+
import errno
|
3
|
+
import logging
|
4
|
+
import sys
|
5
|
+
import warnings
|
6
|
+
|
7
|
+
from socket import error as SocketError, timeout as SocketTimeout
|
8
|
+
import socket
|
9
|
+
|
10
|
+
try: # Python 3
|
11
|
+
from queue import LifoQueue, Empty, Full
|
12
|
+
except ImportError:
|
13
|
+
from Queue import LifoQueue, Empty, Full
|
14
|
+
# Queue is imported for side effects on MS Windows
|
15
|
+
import Queue as _unused_module_Queue # noqa: unused
|
16
|
+
|
17
|
+
|
18
|
+
from .exceptions import (
|
19
|
+
ClosedPoolError,
|
20
|
+
ProtocolError,
|
21
|
+
EmptyPoolError,
|
22
|
+
HeaderParsingError,
|
23
|
+
HostChangedError,
|
24
|
+
LocationValueError,
|
25
|
+
MaxRetryError,
|
26
|
+
ProxyError,
|
27
|
+
ReadTimeoutError,
|
28
|
+
SSLError,
|
29
|
+
TimeoutError,
|
30
|
+
InsecureRequestWarning,
|
31
|
+
NewConnectionError,
|
32
|
+
)
|
33
|
+
from .packages.ssl_match_hostname import CertificateError
|
34
|
+
from .packages import six
|
35
|
+
from .connection import (
|
36
|
+
port_by_scheme,
|
37
|
+
DummyConnection,
|
38
|
+
HTTPConnection, HTTPSConnection, VerifiedHTTPSConnection,
|
39
|
+
HTTPException, BaseSSLError,
|
40
|
+
)
|
41
|
+
from .request import RequestMethods
|
42
|
+
from .response import HTTPResponse
|
43
|
+
|
44
|
+
from .util.connection import is_connection_dropped
|
45
|
+
from .util.response import assert_header_parsing
|
46
|
+
from .util.retry import Retry
|
47
|
+
from .util.timeout import Timeout
|
48
|
+
from .util.url import get_host, Url
|
49
|
+
|
50
|
+
|
51
|
+
xrange = six.moves.xrange
|
52
|
+
|
53
|
+
log = logging.getLogger(__name__)
|
54
|
+
|
55
|
+
_Default = object()
|
56
|
+
|
57
|
+
|
58
|
+
# Pool objects
|
59
|
+
class ConnectionPool(object):
|
60
|
+
"""
|
61
|
+
Base class for all connection pools, such as
|
62
|
+
:class:`.HTTPConnectionPool` and :class:`.HTTPSConnectionPool`.
|
63
|
+
"""
|
64
|
+
|
65
|
+
scheme = None
|
66
|
+
QueueCls = LifoQueue
|
67
|
+
|
68
|
+
def __init__(self, host, port=None):
|
69
|
+
if not host:
|
70
|
+
raise LocationValueError("No host specified.")
|
71
|
+
|
72
|
+
# httplib doesn't like it when we include brackets in ipv6 addresses
|
73
|
+
# Specifically, if we include brackets but also pass the port then
|
74
|
+
# httplib crazily doubles up the square brackets on the Host header.
|
75
|
+
# Instead, we need to make sure we never pass ``None`` as the port.
|
76
|
+
# However, for backward compatibility reasons we can't actually
|
77
|
+
# *assert* that.
|
78
|
+
self.host = host.strip('[]')
|
79
|
+
self.port = port
|
80
|
+
|
81
|
+
def __str__(self):
|
82
|
+
return '%s(host=%r, port=%r)' % (type(self).__name__,
|
83
|
+
self.host, self.port)
|
84
|
+
|
85
|
+
def __enter__(self):
|
86
|
+
return self
|
87
|
+
|
88
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
89
|
+
self.close()
|
90
|
+
# Return False to re-raise any potential exceptions
|
91
|
+
return False
|
92
|
+
|
93
|
+
def close(self):
|
94
|
+
"""
|
95
|
+
Close all pooled connections and disable the pool.
|
96
|
+
"""
|
97
|
+
pass
|
98
|
+
|
99
|
+
|
100
|
+
# This is taken from http://hg.python.org/cpython/file/7aaba721ebc0/Lib/socket.py#l252
|
101
|
+
_blocking_errnos = set([errno.EAGAIN, errno.EWOULDBLOCK])
|
102
|
+
|
103
|
+
|
104
|
+
class HTTPConnectionPool(ConnectionPool, RequestMethods):
|
105
|
+
"""
|
106
|
+
Thread-safe connection pool for one host.
|
107
|
+
|
108
|
+
:param host:
|
109
|
+
Host used for this HTTP Connection (e.g. "localhost"), passed into
|
110
|
+
:class:`httplib.HTTPConnection`.
|
111
|
+
|
112
|
+
:param port:
|
113
|
+
Port used for this HTTP Connection (None is equivalent to 80), passed
|
114
|
+
into :class:`httplib.HTTPConnection`.
|
115
|
+
|
116
|
+
:param strict:
|
117
|
+
Causes BadStatusLine to be raised if the status line can't be parsed
|
118
|
+
as a valid HTTP/1.0 or 1.1 status line, passed into
|
119
|
+
:class:`httplib.HTTPConnection`.
|
120
|
+
|
121
|
+
.. note::
|
122
|
+
Only works in Python 2. This parameter is ignored in Python 3.
|
123
|
+
|
124
|
+
:param timeout:
|
125
|
+
Socket timeout in seconds for each individual connection. This can
|
126
|
+
be a float or integer, which sets the timeout for the HTTP request,
|
127
|
+
or an instance of :class:`urllib3.util.Timeout` which gives you more
|
128
|
+
fine-grained control over request timeouts. After the constructor has
|
129
|
+
been parsed, this is always a `urllib3.util.Timeout` object.
|
130
|
+
|
131
|
+
:param maxsize:
|
132
|
+
Number of connections to save that can be reused. More than 1 is useful
|
133
|
+
in multithreaded situations. If ``block`` is set to False, more
|
134
|
+
connections will be created but they will not be saved once they've
|
135
|
+
been used.
|
136
|
+
|
137
|
+
:param block:
|
138
|
+
If set to True, no more than ``maxsize`` connections will be used at
|
139
|
+
a time. When no free connections are available, the call will block
|
140
|
+
until a connection has been released. This is a useful side effect for
|
141
|
+
particular multithreaded situations where one does not want to use more
|
142
|
+
than maxsize connections per host to prevent flooding.
|
143
|
+
|
144
|
+
:param headers:
|
145
|
+
Headers to include with all requests, unless other headers are given
|
146
|
+
explicitly.
|
147
|
+
|
148
|
+
:param retries:
|
149
|
+
Retry configuration to use by default with requests in this pool.
|
150
|
+
|
151
|
+
:param _proxy:
|
152
|
+
Parsed proxy URL, should not be used directly, instead, see
|
153
|
+
:class:`urllib3.connectionpool.ProxyManager`"
|
154
|
+
|
155
|
+
:param _proxy_headers:
|
156
|
+
A dictionary with proxy headers, should not be used directly,
|
157
|
+
instead, see :class:`urllib3.connectionpool.ProxyManager`"
|
158
|
+
|
159
|
+
:param \**conn_kw:
|
160
|
+
Additional parameters are used to create fresh :class:`urllib3.connection.HTTPConnection`,
|
161
|
+
:class:`urllib3.connection.HTTPSConnection` instances.
|
162
|
+
"""
|
163
|
+
|
164
|
+
scheme = 'http'
|
165
|
+
ConnectionCls = HTTPConnection
|
166
|
+
ResponseCls = HTTPResponse
|
167
|
+
|
168
|
+
def __init__(self, host, port=None, strict=False,
|
169
|
+
timeout=Timeout.DEFAULT_TIMEOUT, maxsize=1, block=False,
|
170
|
+
headers=None, retries=None,
|
171
|
+
_proxy=None, _proxy_headers=None,
|
172
|
+
**conn_kw):
|
173
|
+
ConnectionPool.__init__(self, host, port)
|
174
|
+
RequestMethods.__init__(self, headers)
|
175
|
+
|
176
|
+
self.strict = strict
|
177
|
+
|
178
|
+
if not isinstance(timeout, Timeout):
|
179
|
+
timeout = Timeout.from_float(timeout)
|
180
|
+
|
181
|
+
if retries is None:
|
182
|
+
retries = Retry.DEFAULT
|
183
|
+
|
184
|
+
self.timeout = timeout
|
185
|
+
self.retries = retries
|
186
|
+
|
187
|
+
self.pool = self.QueueCls(maxsize)
|
188
|
+
self.block = block
|
189
|
+
|
190
|
+
self.proxy = _proxy
|
191
|
+
self.proxy_headers = _proxy_headers or {}
|
192
|
+
|
193
|
+
# Fill the queue up so that doing get() on it will block properly
|
194
|
+
for _ in xrange(maxsize):
|
195
|
+
self.pool.put(None)
|
196
|
+
|
197
|
+
# These are mostly for testing and debugging purposes.
|
198
|
+
self.num_connections = 0
|
199
|
+
self.num_requests = 0
|
200
|
+
self.conn_kw = conn_kw
|
201
|
+
|
202
|
+
if self.proxy:
|
203
|
+
# Enable Nagle's algorithm for proxies, to avoid packet fragmentation.
|
204
|
+
# We cannot know if the user has added default socket options, so we cannot replace the
|
205
|
+
# list.
|
206
|
+
self.conn_kw.setdefault('socket_options', [])
|
207
|
+
|
208
|
+
def _new_conn(self):
|
209
|
+
"""
|
210
|
+
Return a fresh :class:`HTTPConnection`.
|
211
|
+
"""
|
212
|
+
self.num_connections += 1
|
213
|
+
log.info("Starting new HTTP connection (%d): %s",
|
214
|
+
self.num_connections, self.host)
|
215
|
+
|
216
|
+
conn = self.ConnectionCls(host=self.host, port=self.port,
|
217
|
+
timeout=self.timeout.connect_timeout,
|
218
|
+
strict=self.strict, **self.conn_kw)
|
219
|
+
return conn
|
220
|
+
|
221
|
+
def _get_conn(self, timeout=None):
|
222
|
+
"""
|
223
|
+
Get a connection. Will return a pooled connection if one is available.
|
224
|
+
|
225
|
+
If no connections are available and :prop:`.block` is ``False``, then a
|
226
|
+
fresh connection is returned.
|
227
|
+
|
228
|
+
:param timeout:
|
229
|
+
Seconds to wait before giving up and raising
|
230
|
+
:class:`urllib3.exceptions.EmptyPoolError` if the pool is empty and
|
231
|
+
:prop:`.block` is ``True``.
|
232
|
+
"""
|
233
|
+
conn = None
|
234
|
+
try:
|
235
|
+
conn = self.pool.get(block=self.block, timeout=timeout)
|
236
|
+
|
237
|
+
except AttributeError: # self.pool is None
|
238
|
+
raise ClosedPoolError(self, "Pool is closed.")
|
239
|
+
|
240
|
+
except Empty:
|
241
|
+
if self.block:
|
242
|
+
raise EmptyPoolError(self,
|
243
|
+
"Pool reached maximum size and no more "
|
244
|
+
"connections are allowed.")
|
245
|
+
pass # Oh well, we'll create a new connection then
|
246
|
+
|
247
|
+
# If this is a persistent connection, check if it got disconnected
|
248
|
+
if conn and is_connection_dropped(conn):
|
249
|
+
log.info("Resetting dropped connection: %s", self.host)
|
250
|
+
conn.close()
|
251
|
+
if getattr(conn, 'auto_open', 1) == 0:
|
252
|
+
# This is a proxied connection that has been mutated by
|
253
|
+
# httplib._tunnel() and cannot be reused (since it would
|
254
|
+
# attempt to bypass the proxy)
|
255
|
+
conn = None
|
256
|
+
|
257
|
+
return conn or self._new_conn()
|
258
|
+
|
259
|
+
def _put_conn(self, conn):
|
260
|
+
"""
|
261
|
+
Put a connection back into the pool.
|
262
|
+
|
263
|
+
:param conn:
|
264
|
+
Connection object for the current host and port as returned by
|
265
|
+
:meth:`._new_conn` or :meth:`._get_conn`.
|
266
|
+
|
267
|
+
If the pool is already full, the connection is closed and discarded
|
268
|
+
because we exceeded maxsize. If connections are discarded frequently,
|
269
|
+
then maxsize should be increased.
|
270
|
+
|
271
|
+
If the pool is closed, then the connection will be closed and discarded.
|
272
|
+
"""
|
273
|
+
try:
|
274
|
+
self.pool.put(conn, block=False)
|
275
|
+
return # Everything is dandy, done.
|
276
|
+
except AttributeError:
|
277
|
+
# self.pool is None.
|
278
|
+
pass
|
279
|
+
except Full:
|
280
|
+
# This should never happen if self.block == True
|
281
|
+
log.warning(
|
282
|
+
"Connection pool is full, discarding connection: %s",
|
283
|
+
self.host)
|
284
|
+
|
285
|
+
# Connection never got put back into the pool, close it.
|
286
|
+
if conn:
|
287
|
+
conn.close()
|
288
|
+
|
289
|
+
def _validate_conn(self, conn):
|
290
|
+
"""
|
291
|
+
Called right before a request is made, after the socket is created.
|
292
|
+
"""
|
293
|
+
pass
|
294
|
+
|
295
|
+
def _prepare_proxy(self, conn):
|
296
|
+
# Nothing to do for HTTP connections.
|
297
|
+
pass
|
298
|
+
|
299
|
+
def _get_timeout(self, timeout):
|
300
|
+
""" Helper that always returns a :class:`urllib3.util.Timeout` """
|
301
|
+
if timeout is _Default:
|
302
|
+
return self.timeout.clone()
|
303
|
+
|
304
|
+
if isinstance(timeout, Timeout):
|
305
|
+
return timeout.clone()
|
306
|
+
else:
|
307
|
+
# User passed us an int/float. This is for backwards compatibility,
|
308
|
+
# can be removed later
|
309
|
+
return Timeout.from_float(timeout)
|
310
|
+
|
311
|
+
def _raise_timeout(self, err, url, timeout_value):
|
312
|
+
"""Is the error actually a timeout? Will raise a ReadTimeout or pass"""
|
313
|
+
|
314
|
+
if isinstance(err, SocketTimeout):
|
315
|
+
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
|
316
|
+
|
317
|
+
# See the above comment about EAGAIN in Python 3. In Python 2 we have
|
318
|
+
# to specifically catch it and throw the timeout error
|
319
|
+
if hasattr(err, 'errno') and err.errno in _blocking_errnos:
|
320
|
+
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
|
321
|
+
|
322
|
+
# Catch possible read timeouts thrown as SSL errors. If not the
|
323
|
+
# case, rethrow the original. We need to do this because of:
|
324
|
+
# http://bugs.python.org/issue10272
|
325
|
+
if 'timed out' in str(err) or 'did not complete (read)' in str(err): # Python 2.6
|
326
|
+
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
|
327
|
+
|
328
|
+
def _make_request(self, conn, method, url, timeout=_Default, chunked=False,
|
329
|
+
**httplib_request_kw):
|
330
|
+
"""
|
331
|
+
Perform a request on a given urllib connection object taken from our
|
332
|
+
pool.
|
333
|
+
|
334
|
+
:param conn:
|
335
|
+
a connection from one of our connection pools
|
336
|
+
|
337
|
+
:param timeout:
|
338
|
+
Socket timeout in seconds for the request. This can be a
|
339
|
+
float or integer, which will set the same timeout value for
|
340
|
+
the socket connect and the socket read, or an instance of
|
341
|
+
:class:`urllib3.util.Timeout`, which gives you more fine-grained
|
342
|
+
control over your timeouts.
|
343
|
+
"""
|
344
|
+
self.num_requests += 1
|
345
|
+
|
346
|
+
timeout_obj = self._get_timeout(timeout)
|
347
|
+
timeout_obj.start_connect()
|
348
|
+
conn.timeout = timeout_obj.connect_timeout
|
349
|
+
|
350
|
+
# Trigger any extra validation we need to do.
|
351
|
+
try:
|
352
|
+
self._validate_conn(conn)
|
353
|
+
except (SocketTimeout, BaseSSLError) as e:
|
354
|
+
# Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.
|
355
|
+
self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
|
356
|
+
raise
|
357
|
+
|
358
|
+
# conn.request() calls httplib.*.request, not the method in
|
359
|
+
# urllib3.request. It also calls makefile (recv) on the socket.
|
360
|
+
if chunked:
|
361
|
+
conn.request_chunked(method, url, **httplib_request_kw)
|
362
|
+
else:
|
363
|
+
conn.request(method, url, **httplib_request_kw)
|
364
|
+
|
365
|
+
# Reset the timeout for the recv() on the socket
|
366
|
+
read_timeout = timeout_obj.read_timeout
|
367
|
+
|
368
|
+
# App Engine doesn't have a sock attr
|
369
|
+
if getattr(conn, 'sock', None):
|
370
|
+
# In Python 3 socket.py will catch EAGAIN and return None when you
|
371
|
+
# try and read into the file pointer created by http.client, which
|
372
|
+
# instead raises a BadStatusLine exception. Instead of catching
|
373
|
+
# the exception and assuming all BadStatusLine exceptions are read
|
374
|
+
# timeouts, check for a zero timeout before making the request.
|
375
|
+
if read_timeout == 0:
|
376
|
+
raise ReadTimeoutError(
|
377
|
+
self, url, "Read timed out. (read timeout=%s)" % read_timeout)
|
378
|
+
if read_timeout is Timeout.DEFAULT_TIMEOUT:
|
379
|
+
conn.sock.settimeout(socket.getdefaulttimeout())
|
380
|
+
else: # None or a value
|
381
|
+
conn.sock.settimeout(read_timeout)
|
382
|
+
|
383
|
+
# Receive the response from the server
|
384
|
+
try:
|
385
|
+
try: # Python 2.7, use buffering of HTTP responses
|
386
|
+
httplib_response = conn.getresponse(buffering=True)
|
387
|
+
except TypeError: # Python 2.6 and older, Python 3
|
388
|
+
try:
|
389
|
+
httplib_response = conn.getresponse()
|
390
|
+
except Exception as e:
|
391
|
+
# Remove the TypeError from the exception chain in Python 3;
|
392
|
+
# otherwise it looks like a programming error was the cause.
|
393
|
+
six.raise_from(e, None)
|
394
|
+
except (SocketTimeout, BaseSSLError, SocketError) as e:
|
395
|
+
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
|
396
|
+
raise
|
397
|
+
|
398
|
+
# AppEngine doesn't have a version attr.
|
399
|
+
http_version = getattr(conn, '_http_vsn_str', 'HTTP/?')
|
400
|
+
log.debug("\"%s %s %s\" %s %s", method, url, http_version,
|
401
|
+
httplib_response.status, httplib_response.length)
|
402
|
+
|
403
|
+
try:
|
404
|
+
assert_header_parsing(httplib_response.msg)
|
405
|
+
except HeaderParsingError as hpe: # Platform-specific: Python 3
|
406
|
+
log.warning(
|
407
|
+
'Failed to parse headers (url=%s): %s',
|
408
|
+
self._absolute_url(url), hpe, exc_info=True)
|
409
|
+
|
410
|
+
return httplib_response
|
411
|
+
|
412
|
+
def _absolute_url(self, path):
|
413
|
+
return Url(scheme=self.scheme, host=self.host, port=self.port, path=path).url
|
414
|
+
|
415
|
+
def close(self):
|
416
|
+
"""
|
417
|
+
Close all pooled connections and disable the pool.
|
418
|
+
"""
|
419
|
+
# Disable access to the pool
|
420
|
+
old_pool, self.pool = self.pool, None
|
421
|
+
|
422
|
+
try:
|
423
|
+
while True:
|
424
|
+
conn = old_pool.get(block=False)
|
425
|
+
if conn:
|
426
|
+
conn.close()
|
427
|
+
|
428
|
+
except Empty:
|
429
|
+
pass # Done.
|
430
|
+
|
431
|
+
def is_same_host(self, url):
|
432
|
+
"""
|
433
|
+
Check if the given ``url`` is a member of the same host as this
|
434
|
+
connection pool.
|
435
|
+
"""
|
436
|
+
if url.startswith('/'):
|
437
|
+
return True
|
438
|
+
|
439
|
+
# TODO: Add optional support for socket.gethostbyname checking.
|
440
|
+
scheme, host, port = get_host(url)
|
441
|
+
|
442
|
+
# Use explicit default port for comparison when none is given
|
443
|
+
if self.port and not port:
|
444
|
+
port = port_by_scheme.get(scheme)
|
445
|
+
elif not self.port and port == port_by_scheme.get(scheme):
|
446
|
+
port = None
|
447
|
+
|
448
|
+
return (scheme, host, port) == (self.scheme, self.host, self.port)
|
449
|
+
|
450
|
+
def urlopen(self, method, url, body=None, headers=None, retries=None,
|
451
|
+
redirect=True, assert_same_host=True, timeout=_Default,
|
452
|
+
pool_timeout=None, release_conn=None, chunked=False,
|
453
|
+
**response_kw):
|
454
|
+
"""
|
455
|
+
Get a connection from the pool and perform an HTTP request. This is the
|
456
|
+
lowest level call for making a request, so you'll need to specify all
|
457
|
+
the raw details.
|
458
|
+
|
459
|
+
.. note::
|
460
|
+
|
461
|
+
More commonly, it's appropriate to use a convenience method provided
|
462
|
+
by :class:`.RequestMethods`, such as :meth:`request`.
|
463
|
+
|
464
|
+
.. note::
|
465
|
+
|
466
|
+
`release_conn` will only behave as expected if
|
467
|
+
`preload_content=False` because we want to make
|
468
|
+
`preload_content=False` the default behaviour someday soon without
|
469
|
+
breaking backwards compatibility.
|
470
|
+
|
471
|
+
:param method:
|
472
|
+
HTTP request method (such as GET, POST, PUT, etc.)
|
473
|
+
|
474
|
+
:param body:
|
475
|
+
Data to send in the request body (useful for creating
|
476
|
+
POST requests, see HTTPConnectionPool.post_url for
|
477
|
+
more convenience).
|
478
|
+
|
479
|
+
:param headers:
|
480
|
+
Dictionary of custom headers to send, such as User-Agent,
|
481
|
+
If-None-Match, etc. If None, pool headers are used. If provided,
|
482
|
+
these headers completely replace any pool-specific headers.
|
483
|
+
|
484
|
+
:param retries:
|
485
|
+
Configure the number of retries to allow before raising a
|
486
|
+
:class:`~urllib3.exceptions.MaxRetryError` exception.
|
487
|
+
|
488
|
+
Pass ``None`` to retry until you receive a response. Pass a
|
489
|
+
:class:`~urllib3.util.retry.Retry` object for fine-grained control
|
490
|
+
over different types of retries.
|
491
|
+
Pass an integer number to retry connection errors that many times,
|
492
|
+
but no other types of errors. Pass zero to never retry.
|
493
|
+
|
494
|
+
If ``False``, then retries are disabled and any exception is raised
|
495
|
+
immediately. Also, instead of raising a MaxRetryError on redirects,
|
496
|
+
the redirect response will be returned.
|
497
|
+
|
498
|
+
:type retries: :class:`~urllib3.util.retry.Retry`, False, or an int.
|
499
|
+
|
500
|
+
:param redirect:
|
501
|
+
If True, automatically handle redirects (status codes 301, 302,
|
502
|
+
303, 307, 308). Each redirect counts as a retry. Disabling retries
|
503
|
+
will disable redirect, too.
|
504
|
+
|
505
|
+
:param assert_same_host:
|
506
|
+
If ``True``, will make sure that the host of the pool requests is
|
507
|
+
consistent else will raise HostChangedError. When False, you can
|
508
|
+
use the pool on an HTTP proxy and request foreign hosts.
|
509
|
+
|
510
|
+
:param timeout:
|
511
|
+
If specified, overrides the default timeout for this one
|
512
|
+
request. It may be a float (in seconds) or an instance of
|
513
|
+
:class:`urllib3.util.Timeout`.
|
514
|
+
|
515
|
+
:param pool_timeout:
|
516
|
+
If set and the pool is set to block=True, then this method will
|
517
|
+
block for ``pool_timeout`` seconds and raise EmptyPoolError if no
|
518
|
+
connection is available within the time period.
|
519
|
+
|
520
|
+
:param release_conn:
|
521
|
+
If False, then the urlopen call will not release the connection
|
522
|
+
back into the pool once a response is received (but will release if
|
523
|
+
you read the entire contents of the response such as when
|
524
|
+
`preload_content=True`). This is useful if you're not preloading
|
525
|
+
the response's content immediately. You will need to call
|
526
|
+
``r.release_conn()`` on the response ``r`` to return the connection
|
527
|
+
back into the pool. If None, it takes the value of
|
528
|
+
``response_kw.get('preload_content', True)``.
|
529
|
+
|
530
|
+
:param chunked:
|
531
|
+
If True, urllib3 will send the body using chunked transfer
|
532
|
+
encoding. Otherwise, urllib3 will send the body using the standard
|
533
|
+
content-length form. Defaults to False.
|
534
|
+
|
535
|
+
:param \**response_kw:
|
536
|
+
Additional parameters are passed to
|
537
|
+
:meth:`urllib3.response.HTTPResponse.from_httplib`
|
538
|
+
"""
|
539
|
+
if headers is None:
|
540
|
+
headers = self.headers
|
541
|
+
|
542
|
+
if not isinstance(retries, Retry):
|
543
|
+
retries = Retry.from_int(retries, redirect=redirect, default=self.retries)
|
544
|
+
|
545
|
+
if release_conn is None:
|
546
|
+
release_conn = response_kw.get('preload_content', True)
|
547
|
+
|
548
|
+
# Check host
|
549
|
+
if assert_same_host and not self.is_same_host(url):
|
550
|
+
raise HostChangedError(self, url, retries)
|
551
|
+
|
552
|
+
conn = None
|
553
|
+
|
554
|
+
# Track whether `conn` needs to be released before
|
555
|
+
# returning/raising/recursing. Update this variable if necessary, and
|
556
|
+
# leave `release_conn` constant throughout the function. That way, if
|
557
|
+
# the function recurses, the original value of `release_conn` will be
|
558
|
+
# passed down into the recursive call, and its value will be respected.
|
559
|
+
#
|
560
|
+
# See issue #651 [1] for details.
|
561
|
+
#
|
562
|
+
# [1] <https://github.com/shazow/urllib3/issues/651>
|
563
|
+
release_this_conn = release_conn
|
564
|
+
|
565
|
+
# Merge the proxy headers. Only do this in HTTP. We have to copy the
|
566
|
+
# headers dict so we can safely change it without those changes being
|
567
|
+
# reflected in anyone else's copy.
|
568
|
+
if self.scheme == 'http':
|
569
|
+
headers = headers.copy()
|
570
|
+
headers.update(self.proxy_headers)
|
571
|
+
|
572
|
+
# Must keep the exception bound to a separate variable or else Python 3
|
573
|
+
# complains about UnboundLocalError.
|
574
|
+
err = None
|
575
|
+
|
576
|
+
# Keep track of whether we cleanly exited the except block. This
|
577
|
+
# ensures we do proper cleanup in finally.
|
578
|
+
clean_exit = False
|
579
|
+
|
580
|
+
try:
|
581
|
+
# Request a connection from the queue.
|
582
|
+
timeout_obj = self._get_timeout(timeout)
|
583
|
+
conn = self._get_conn(timeout=pool_timeout)
|
584
|
+
|
585
|
+
conn.timeout = timeout_obj.connect_timeout
|
586
|
+
|
587
|
+
is_new_proxy_conn = self.proxy is not None and not getattr(conn, 'sock', None)
|
588
|
+
if is_new_proxy_conn:
|
589
|
+
self._prepare_proxy(conn)
|
590
|
+
|
591
|
+
# Make the request on the httplib connection object.
|
592
|
+
httplib_response = self._make_request(conn, method, url,
|
593
|
+
timeout=timeout_obj,
|
594
|
+
body=body, headers=headers,
|
595
|
+
chunked=chunked)
|
596
|
+
|
597
|
+
# If we're going to release the connection in ``finally:``, then
|
598
|
+
# the response doesn't need to know about the connection. Otherwise
|
599
|
+
# it will also try to release it and we'll have a double-release
|
600
|
+
# mess.
|
601
|
+
response_conn = conn if not release_conn else None
|
602
|
+
|
603
|
+
# Import httplib's response into our own wrapper object
|
604
|
+
response = self.ResponseCls.from_httplib(httplib_response,
|
605
|
+
pool=self,
|
606
|
+
connection=response_conn,
|
607
|
+
**response_kw)
|
608
|
+
|
609
|
+
# Everything went great!
|
610
|
+
clean_exit = True
|
611
|
+
|
612
|
+
except Empty:
|
613
|
+
# Timed out by queue.
|
614
|
+
raise EmptyPoolError(self, "No pool connections are available.")
|
615
|
+
|
616
|
+
except (BaseSSLError, CertificateError) as e:
|
617
|
+
# Close the connection. If a connection is reused on which there
|
618
|
+
# was a Certificate error, the next request will certainly raise
|
619
|
+
# another Certificate error.
|
620
|
+
clean_exit = False
|
621
|
+
raise SSLError(e)
|
622
|
+
|
623
|
+
except SSLError:
|
624
|
+
# Treat SSLError separately from BaseSSLError to preserve
|
625
|
+
# traceback.
|
626
|
+
clean_exit = False
|
627
|
+
raise
|
628
|
+
|
629
|
+
except (TimeoutError, HTTPException, SocketError, ProtocolError) as e:
|
630
|
+
# Discard the connection for these exceptions. It will be
|
631
|
+
# be replaced during the next _get_conn() call.
|
632
|
+
clean_exit = False
|
633
|
+
|
634
|
+
if isinstance(e, (SocketError, NewConnectionError)) and self.proxy:
|
635
|
+
e = ProxyError('Cannot connect to proxy.', e)
|
636
|
+
elif isinstance(e, (SocketError, HTTPException)):
|
637
|
+
e = ProtocolError('Connection aborted.', e)
|
638
|
+
|
639
|
+
retries = retries.increment(method, url, error=e, _pool=self,
|
640
|
+
_stacktrace=sys.exc_info()[2])
|
641
|
+
retries.sleep()
|
642
|
+
|
643
|
+
# Keep track of the error for the retry warning.
|
644
|
+
err = e
|
645
|
+
|
646
|
+
finally:
|
647
|
+
if not clean_exit:
|
648
|
+
# We hit some kind of exception, handled or otherwise. We need
|
649
|
+
# to throw the connection away unless explicitly told not to.
|
650
|
+
# Close the connection, set the variable to None, and make sure
|
651
|
+
# we put the None back in the pool to avoid leaking it.
|
652
|
+
conn = conn and conn.close()
|
653
|
+
release_this_conn = True
|
654
|
+
|
655
|
+
if release_this_conn:
|
656
|
+
# Put the connection back to be reused. If the connection is
|
657
|
+
# expired then it will be None, which will get replaced with a
|
658
|
+
# fresh connection during _get_conn.
|
659
|
+
self._put_conn(conn)
|
660
|
+
|
661
|
+
if not conn:
|
662
|
+
# Try again
|
663
|
+
log.warning("Retrying (%r) after connection "
|
664
|
+
"broken by '%r': %s", retries, err, url)
|
665
|
+
return self.urlopen(method, url, body, headers, retries,
|
666
|
+
redirect, assert_same_host,
|
667
|
+
timeout=timeout, pool_timeout=pool_timeout,
|
668
|
+
release_conn=release_conn, **response_kw)
|
669
|
+
|
670
|
+
# Handle redirect?
|
671
|
+
redirect_location = redirect and response.get_redirect_location()
|
672
|
+
if redirect_location:
|
673
|
+
if response.status == 303:
|
674
|
+
method = 'GET'
|
675
|
+
|
676
|
+
try:
|
677
|
+
retries = retries.increment(method, url, response=response, _pool=self)
|
678
|
+
except MaxRetryError:
|
679
|
+
if retries.raise_on_redirect:
|
680
|
+
# Release the connection for this response, since we're not
|
681
|
+
# returning it to be released manually.
|
682
|
+
response.release_conn()
|
683
|
+
raise
|
684
|
+
return response
|
685
|
+
|
686
|
+
log.info("Redirecting %s -> %s", url, redirect_location)
|
687
|
+
return self.urlopen(
|
688
|
+
method, redirect_location, body, headers,
|
689
|
+
retries=retries, redirect=redirect,
|
690
|
+
assert_same_host=assert_same_host,
|
691
|
+
timeout=timeout, pool_timeout=pool_timeout,
|
692
|
+
release_conn=release_conn, **response_kw)
|
693
|
+
|
694
|
+
# Check if we should retry the HTTP response.
|
695
|
+
if retries.is_forced_retry(method, status_code=response.status):
|
696
|
+
try:
|
697
|
+
retries = retries.increment(method, url, response=response, _pool=self)
|
698
|
+
except MaxRetryError:
|
699
|
+
if retries.raise_on_status:
|
700
|
+
# Release the connection for this response, since we're not
|
701
|
+
# returning it to be released manually.
|
702
|
+
response.release_conn()
|
703
|
+
raise
|
704
|
+
return response
|
705
|
+
retries.sleep()
|
706
|
+
log.info("Forced retry: %s", url)
|
707
|
+
return self.urlopen(
|
708
|
+
method, url, body, headers,
|
709
|
+
retries=retries, redirect=redirect,
|
710
|
+
assert_same_host=assert_same_host,
|
711
|
+
timeout=timeout, pool_timeout=pool_timeout,
|
712
|
+
release_conn=release_conn, **response_kw)
|
713
|
+
|
714
|
+
return response
|
715
|
+
|
716
|
+
|
717
|
+
class HTTPSConnectionPool(HTTPConnectionPool):
|
718
|
+
"""
|
719
|
+
Same as :class:`.HTTPConnectionPool`, but HTTPS.
|
720
|
+
|
721
|
+
When Python is compiled with the :mod:`ssl` module, then
|
722
|
+
:class:`.VerifiedHTTPSConnection` is used, which *can* verify certificates,
|
723
|
+
instead of :class:`.HTTPSConnection`.
|
724
|
+
|
725
|
+
:class:`.VerifiedHTTPSConnection` uses one of ``assert_fingerprint``,
|
726
|
+
``assert_hostname`` and ``host`` in this order to verify connections.
|
727
|
+
If ``assert_hostname`` is False, no verification is done.
|
728
|
+
|
729
|
+
The ``key_file``, ``cert_file``, ``cert_reqs``, ``ca_certs``,
|
730
|
+
``ca_cert_dir``, and ``ssl_version`` are only used if :mod:`ssl` is
|
731
|
+
available and are fed into :meth:`urllib3.util.ssl_wrap_socket` to upgrade
|
732
|
+
the connection socket into an SSL socket.
|
733
|
+
"""
|
734
|
+
|
735
|
+
scheme = 'https'
|
736
|
+
ConnectionCls = HTTPSConnection
|
737
|
+
|
738
|
+
def __init__(self, host, port=None,
|
739
|
+
strict=False, timeout=Timeout.DEFAULT_TIMEOUT, maxsize=1,
|
740
|
+
block=False, headers=None, retries=None,
|
741
|
+
_proxy=None, _proxy_headers=None,
|
742
|
+
key_file=None, cert_file=None, cert_reqs=None,
|
743
|
+
ca_certs=None, ssl_version=None,
|
744
|
+
assert_hostname=None, assert_fingerprint=None,
|
745
|
+
ca_cert_dir=None, **conn_kw):
|
746
|
+
|
747
|
+
HTTPConnectionPool.__init__(self, host, port, strict, timeout, maxsize,
|
748
|
+
block, headers, retries, _proxy, _proxy_headers,
|
749
|
+
**conn_kw)
|
750
|
+
|
751
|
+
if ca_certs and cert_reqs is None:
|
752
|
+
cert_reqs = 'CERT_REQUIRED'
|
753
|
+
|
754
|
+
self.key_file = key_file
|
755
|
+
self.cert_file = cert_file
|
756
|
+
self.cert_reqs = cert_reqs
|
757
|
+
self.ca_certs = ca_certs
|
758
|
+
self.ca_cert_dir = ca_cert_dir
|
759
|
+
self.ssl_version = ssl_version
|
760
|
+
self.assert_hostname = assert_hostname
|
761
|
+
self.assert_fingerprint = assert_fingerprint
|
762
|
+
|
763
|
+
def _prepare_conn(self, conn):
|
764
|
+
"""
|
765
|
+
Prepare the ``connection`` for :meth:`urllib3.util.ssl_wrap_socket`
|
766
|
+
and establish the tunnel if proxy is used.
|
767
|
+
"""
|
768
|
+
|
769
|
+
if isinstance(conn, VerifiedHTTPSConnection):
|
770
|
+
conn.set_cert(key_file=self.key_file,
|
771
|
+
cert_file=self.cert_file,
|
772
|
+
cert_reqs=self.cert_reqs,
|
773
|
+
ca_certs=self.ca_certs,
|
774
|
+
ca_cert_dir=self.ca_cert_dir,
|
775
|
+
assert_hostname=self.assert_hostname,
|
776
|
+
assert_fingerprint=self.assert_fingerprint)
|
777
|
+
conn.ssl_version = self.ssl_version
|
778
|
+
|
779
|
+
return conn
|
780
|
+
|
781
|
+
def _prepare_proxy(self, conn):
|
782
|
+
"""
|
783
|
+
Establish tunnel connection early, because otherwise httplib
|
784
|
+
would improperly set Host: header to proxy's IP:port.
|
785
|
+
"""
|
786
|
+
# Python 2.7+
|
787
|
+
try:
|
788
|
+
set_tunnel = conn.set_tunnel
|
789
|
+
except AttributeError: # Platform-specific: Python 2.6
|
790
|
+
set_tunnel = conn._set_tunnel
|
791
|
+
|
792
|
+
if sys.version_info <= (2, 6, 4) and not self.proxy_headers: # Python 2.6.4 and older
|
793
|
+
set_tunnel(self.host, self.port)
|
794
|
+
else:
|
795
|
+
set_tunnel(self.host, self.port, self.proxy_headers)
|
796
|
+
|
797
|
+
conn.connect()
|
798
|
+
|
799
|
+
def _new_conn(self):
|
800
|
+
"""
|
801
|
+
Return a fresh :class:`httplib.HTTPSConnection`.
|
802
|
+
"""
|
803
|
+
self.num_connections += 1
|
804
|
+
log.info("Starting new HTTPS connection (%d): %s",
|
805
|
+
self.num_connections, self.host)
|
806
|
+
|
807
|
+
if not self.ConnectionCls or self.ConnectionCls is DummyConnection:
|
808
|
+
raise SSLError("Can't connect to HTTPS URL because the SSL "
|
809
|
+
"module is not available.")
|
810
|
+
|
811
|
+
actual_host = self.host
|
812
|
+
actual_port = self.port
|
813
|
+
if self.proxy is not None:
|
814
|
+
actual_host = self.proxy.host
|
815
|
+
actual_port = self.proxy.port
|
816
|
+
|
817
|
+
conn = self.ConnectionCls(host=actual_host, port=actual_port,
|
818
|
+
timeout=self.timeout.connect_timeout,
|
819
|
+
strict=self.strict, **self.conn_kw)
|
820
|
+
|
821
|
+
return self._prepare_conn(conn)
|
822
|
+
|
823
|
+
def _validate_conn(self, conn):
|
824
|
+
"""
|
825
|
+
Called right before a request is made, after the socket is created.
|
826
|
+
"""
|
827
|
+
super(HTTPSConnectionPool, self)._validate_conn(conn)
|
828
|
+
|
829
|
+
# Force connect early to allow us to validate the connection.
|
830
|
+
if not getattr(conn, 'sock', None): # AppEngine might not have `.sock`
|
831
|
+
conn.connect()
|
832
|
+
|
833
|
+
if not conn.is_verified:
|
834
|
+
warnings.warn((
|
835
|
+
'Unverified HTTPS request is being made. '
|
836
|
+
'Adding certificate verification is strongly advised. See: '
|
837
|
+
'https://urllib3.readthedocs.io/en/latest/security.html'),
|
838
|
+
InsecureRequestWarning)
|
839
|
+
|
840
|
+
|
841
|
+
def connection_from_url(url, **kw):
|
842
|
+
"""
|
843
|
+
Given a url, return an :class:`.ConnectionPool` instance of its host.
|
844
|
+
|
845
|
+
This is a shortcut for not having to parse out the scheme, host, and port
|
846
|
+
of the url before creating an :class:`.ConnectionPool` instance.
|
847
|
+
|
848
|
+
:param url:
|
849
|
+
Absolute URL string that must include the scheme. Port is optional.
|
850
|
+
|
851
|
+
:param \**kw:
|
852
|
+
Passes additional parameters to the constructor of the appropriate
|
853
|
+
:class:`.ConnectionPool`. Useful for specifying things like
|
854
|
+
timeout, maxsize, headers, etc.
|
855
|
+
|
856
|
+
Example::
|
857
|
+
|
858
|
+
>>> conn = connection_from_url('http://google.com/')
|
859
|
+
>>> r = conn.request('GET', '/')
|
860
|
+
"""
|
861
|
+
scheme, host, port = get_host(url)
|
862
|
+
port = port or port_by_scheme.get(scheme, 80)
|
863
|
+
if scheme == 'https':
|
864
|
+
return HTTPSConnectionPool(host, port=port, **kw)
|
865
|
+
else:
|
866
|
+
return HTTPConnectionPool(host, port=port, **kw)
|