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,324 @@
|
|
1
|
+
from __future__ import absolute_import
|
2
|
+
from collections import Mapping, MutableMapping
|
3
|
+
try:
|
4
|
+
from threading import RLock
|
5
|
+
except ImportError: # Platform-specific: No threads available
|
6
|
+
class RLock:
|
7
|
+
def __enter__(self):
|
8
|
+
pass
|
9
|
+
|
10
|
+
def __exit__(self, exc_type, exc_value, traceback):
|
11
|
+
pass
|
12
|
+
|
13
|
+
|
14
|
+
try: # Python 2.7+
|
15
|
+
from collections import OrderedDict
|
16
|
+
except ImportError:
|
17
|
+
from .packages.ordered_dict import OrderedDict
|
18
|
+
from .packages.six import iterkeys, itervalues, PY3
|
19
|
+
|
20
|
+
|
21
|
+
__all__ = ['RecentlyUsedContainer', 'HTTPHeaderDict']
|
22
|
+
|
23
|
+
|
24
|
+
_Null = object()
|
25
|
+
|
26
|
+
|
27
|
+
class RecentlyUsedContainer(MutableMapping):
|
28
|
+
"""
|
29
|
+
Provides a thread-safe dict-like container which maintains up to
|
30
|
+
``maxsize`` keys while throwing away the least-recently-used keys beyond
|
31
|
+
``maxsize``.
|
32
|
+
|
33
|
+
:param maxsize:
|
34
|
+
Maximum number of recent elements to retain.
|
35
|
+
|
36
|
+
:param dispose_func:
|
37
|
+
Every time an item is evicted from the container,
|
38
|
+
``dispose_func(value)`` is called. Callback which will get called
|
39
|
+
"""
|
40
|
+
|
41
|
+
ContainerCls = OrderedDict
|
42
|
+
|
43
|
+
def __init__(self, maxsize=10, dispose_func=None):
|
44
|
+
self._maxsize = maxsize
|
45
|
+
self.dispose_func = dispose_func
|
46
|
+
|
47
|
+
self._container = self.ContainerCls()
|
48
|
+
self.lock = RLock()
|
49
|
+
|
50
|
+
def __getitem__(self, key):
|
51
|
+
# Re-insert the item, moving it to the end of the eviction line.
|
52
|
+
with self.lock:
|
53
|
+
item = self._container.pop(key)
|
54
|
+
self._container[key] = item
|
55
|
+
return item
|
56
|
+
|
57
|
+
def __setitem__(self, key, value):
|
58
|
+
evicted_value = _Null
|
59
|
+
with self.lock:
|
60
|
+
# Possibly evict the existing value of 'key'
|
61
|
+
evicted_value = self._container.get(key, _Null)
|
62
|
+
self._container[key] = value
|
63
|
+
|
64
|
+
# If we didn't evict an existing value, we might have to evict the
|
65
|
+
# least recently used item from the beginning of the container.
|
66
|
+
if len(self._container) > self._maxsize:
|
67
|
+
_key, evicted_value = self._container.popitem(last=False)
|
68
|
+
|
69
|
+
if self.dispose_func and evicted_value is not _Null:
|
70
|
+
self.dispose_func(evicted_value)
|
71
|
+
|
72
|
+
def __delitem__(self, key):
|
73
|
+
with self.lock:
|
74
|
+
value = self._container.pop(key)
|
75
|
+
|
76
|
+
if self.dispose_func:
|
77
|
+
self.dispose_func(value)
|
78
|
+
|
79
|
+
def __len__(self):
|
80
|
+
with self.lock:
|
81
|
+
return len(self._container)
|
82
|
+
|
83
|
+
def __iter__(self):
|
84
|
+
raise NotImplementedError('Iteration over this class is unlikely to be threadsafe.')
|
85
|
+
|
86
|
+
def clear(self):
|
87
|
+
with self.lock:
|
88
|
+
# Copy pointers to all values, then wipe the mapping
|
89
|
+
values = list(itervalues(self._container))
|
90
|
+
self._container.clear()
|
91
|
+
|
92
|
+
if self.dispose_func:
|
93
|
+
for value in values:
|
94
|
+
self.dispose_func(value)
|
95
|
+
|
96
|
+
def keys(self):
|
97
|
+
with self.lock:
|
98
|
+
return list(iterkeys(self._container))
|
99
|
+
|
100
|
+
|
101
|
+
class HTTPHeaderDict(MutableMapping):
|
102
|
+
"""
|
103
|
+
:param headers:
|
104
|
+
An iterable of field-value pairs. Must not contain multiple field names
|
105
|
+
when compared case-insensitively.
|
106
|
+
|
107
|
+
:param kwargs:
|
108
|
+
Additional field-value pairs to pass in to ``dict.update``.
|
109
|
+
|
110
|
+
A ``dict`` like container for storing HTTP Headers.
|
111
|
+
|
112
|
+
Field names are stored and compared case-insensitively in compliance with
|
113
|
+
RFC 7230. Iteration provides the first case-sensitive key seen for each
|
114
|
+
case-insensitive pair.
|
115
|
+
|
116
|
+
Using ``__setitem__`` syntax overwrites fields that compare equal
|
117
|
+
case-insensitively in order to maintain ``dict``'s api. For fields that
|
118
|
+
compare equal, instead create a new ``HTTPHeaderDict`` and use ``.add``
|
119
|
+
in a loop.
|
120
|
+
|
121
|
+
If multiple fields that are equal case-insensitively are passed to the
|
122
|
+
constructor or ``.update``, the behavior is undefined and some will be
|
123
|
+
lost.
|
124
|
+
|
125
|
+
>>> headers = HTTPHeaderDict()
|
126
|
+
>>> headers.add('Set-Cookie', 'foo=bar')
|
127
|
+
>>> headers.add('set-cookie', 'baz=quxx')
|
128
|
+
>>> headers['content-length'] = '7'
|
129
|
+
>>> headers['SET-cookie']
|
130
|
+
'foo=bar, baz=quxx'
|
131
|
+
>>> headers['Content-Length']
|
132
|
+
'7'
|
133
|
+
"""
|
134
|
+
|
135
|
+
def __init__(self, headers=None, **kwargs):
|
136
|
+
super(HTTPHeaderDict, self).__init__()
|
137
|
+
self._container = OrderedDict()
|
138
|
+
if headers is not None:
|
139
|
+
if isinstance(headers, HTTPHeaderDict):
|
140
|
+
self._copy_from(headers)
|
141
|
+
else:
|
142
|
+
self.extend(headers)
|
143
|
+
if kwargs:
|
144
|
+
self.extend(kwargs)
|
145
|
+
|
146
|
+
def __setitem__(self, key, val):
|
147
|
+
self._container[key.lower()] = (key, val)
|
148
|
+
return self._container[key.lower()]
|
149
|
+
|
150
|
+
def __getitem__(self, key):
|
151
|
+
val = self._container[key.lower()]
|
152
|
+
return ', '.join(val[1:])
|
153
|
+
|
154
|
+
def __delitem__(self, key):
|
155
|
+
del self._container[key.lower()]
|
156
|
+
|
157
|
+
def __contains__(self, key):
|
158
|
+
return key.lower() in self._container
|
159
|
+
|
160
|
+
def __eq__(self, other):
|
161
|
+
if not isinstance(other, Mapping) and not hasattr(other, 'keys'):
|
162
|
+
return False
|
163
|
+
if not isinstance(other, type(self)):
|
164
|
+
other = type(self)(other)
|
165
|
+
return (dict((k.lower(), v) for k, v in self.itermerged()) ==
|
166
|
+
dict((k.lower(), v) for k, v in other.itermerged()))
|
167
|
+
|
168
|
+
def __ne__(self, other):
|
169
|
+
return not self.__eq__(other)
|
170
|
+
|
171
|
+
if not PY3: # Python 2
|
172
|
+
iterkeys = MutableMapping.iterkeys
|
173
|
+
itervalues = MutableMapping.itervalues
|
174
|
+
|
175
|
+
__marker = object()
|
176
|
+
|
177
|
+
def __len__(self):
|
178
|
+
return len(self._container)
|
179
|
+
|
180
|
+
def __iter__(self):
|
181
|
+
# Only provide the originally cased names
|
182
|
+
for vals in self._container.values():
|
183
|
+
yield vals[0]
|
184
|
+
|
185
|
+
def pop(self, key, default=__marker):
|
186
|
+
'''D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
|
187
|
+
If key is not found, d is returned if given, otherwise KeyError is raised.
|
188
|
+
'''
|
189
|
+
# Using the MutableMapping function directly fails due to the private marker.
|
190
|
+
# Using ordinary dict.pop would expose the internal structures.
|
191
|
+
# So let's reinvent the wheel.
|
192
|
+
try:
|
193
|
+
value = self[key]
|
194
|
+
except KeyError:
|
195
|
+
if default is self.__marker:
|
196
|
+
raise
|
197
|
+
return default
|
198
|
+
else:
|
199
|
+
del self[key]
|
200
|
+
return value
|
201
|
+
|
202
|
+
def discard(self, key):
|
203
|
+
try:
|
204
|
+
del self[key]
|
205
|
+
except KeyError:
|
206
|
+
pass
|
207
|
+
|
208
|
+
def add(self, key, val):
|
209
|
+
"""Adds a (name, value) pair, doesn't overwrite the value if it already
|
210
|
+
exists.
|
211
|
+
|
212
|
+
>>> headers = HTTPHeaderDict(foo='bar')
|
213
|
+
>>> headers.add('Foo', 'baz')
|
214
|
+
>>> headers['foo']
|
215
|
+
'bar, baz'
|
216
|
+
"""
|
217
|
+
key_lower = key.lower()
|
218
|
+
new_vals = key, val
|
219
|
+
# Keep the common case aka no item present as fast as possible
|
220
|
+
vals = self._container.setdefault(key_lower, new_vals)
|
221
|
+
if new_vals is not vals:
|
222
|
+
# new_vals was not inserted, as there was a previous one
|
223
|
+
if isinstance(vals, list):
|
224
|
+
# If already several items got inserted, we have a list
|
225
|
+
vals.append(val)
|
226
|
+
else:
|
227
|
+
# vals should be a tuple then, i.e. only one item so far
|
228
|
+
# Need to convert the tuple to list for further extension
|
229
|
+
self._container[key_lower] = [vals[0], vals[1], val]
|
230
|
+
|
231
|
+
def extend(self, *args, **kwargs):
|
232
|
+
"""Generic import function for any type of header-like object.
|
233
|
+
Adapted version of MutableMapping.update in order to insert items
|
234
|
+
with self.add instead of self.__setitem__
|
235
|
+
"""
|
236
|
+
if len(args) > 1:
|
237
|
+
raise TypeError("extend() takes at most 1 positional "
|
238
|
+
"arguments ({0} given)".format(len(args)))
|
239
|
+
other = args[0] if len(args) >= 1 else ()
|
240
|
+
|
241
|
+
if isinstance(other, HTTPHeaderDict):
|
242
|
+
for key, val in other.iteritems():
|
243
|
+
self.add(key, val)
|
244
|
+
elif isinstance(other, Mapping):
|
245
|
+
for key in other:
|
246
|
+
self.add(key, other[key])
|
247
|
+
elif hasattr(other, "keys"):
|
248
|
+
for key in other.keys():
|
249
|
+
self.add(key, other[key])
|
250
|
+
else:
|
251
|
+
for key, value in other:
|
252
|
+
self.add(key, value)
|
253
|
+
|
254
|
+
for key, value in kwargs.items():
|
255
|
+
self.add(key, value)
|
256
|
+
|
257
|
+
def getlist(self, key):
|
258
|
+
"""Returns a list of all the values for the named field. Returns an
|
259
|
+
empty list if the key doesn't exist."""
|
260
|
+
try:
|
261
|
+
vals = self._container[key.lower()]
|
262
|
+
except KeyError:
|
263
|
+
return []
|
264
|
+
else:
|
265
|
+
if isinstance(vals, tuple):
|
266
|
+
return [vals[1]]
|
267
|
+
else:
|
268
|
+
return vals[1:]
|
269
|
+
|
270
|
+
# Backwards compatibility for httplib
|
271
|
+
getheaders = getlist
|
272
|
+
getallmatchingheaders = getlist
|
273
|
+
iget = getlist
|
274
|
+
|
275
|
+
def __repr__(self):
|
276
|
+
return "%s(%s)" % (type(self).__name__, dict(self.itermerged()))
|
277
|
+
|
278
|
+
def _copy_from(self, other):
|
279
|
+
for key in other:
|
280
|
+
val = other.getlist(key)
|
281
|
+
if isinstance(val, list):
|
282
|
+
# Don't need to convert tuples
|
283
|
+
val = list(val)
|
284
|
+
self._container[key.lower()] = [key] + val
|
285
|
+
|
286
|
+
def copy(self):
|
287
|
+
clone = type(self)()
|
288
|
+
clone._copy_from(self)
|
289
|
+
return clone
|
290
|
+
|
291
|
+
def iteritems(self):
|
292
|
+
"""Iterate over all header lines, including duplicate ones."""
|
293
|
+
for key in self:
|
294
|
+
vals = self._container[key.lower()]
|
295
|
+
for val in vals[1:]:
|
296
|
+
yield vals[0], val
|
297
|
+
|
298
|
+
def itermerged(self):
|
299
|
+
"""Iterate over all headers, merging duplicate ones together."""
|
300
|
+
for key in self:
|
301
|
+
val = self._container[key.lower()]
|
302
|
+
yield val[0], ', '.join(val[1:])
|
303
|
+
|
304
|
+
def items(self):
|
305
|
+
return list(self.iteritems())
|
306
|
+
|
307
|
+
@classmethod
|
308
|
+
def from_httplib(cls, message): # Python 2
|
309
|
+
"""Read headers from a Python 2 httplib message object."""
|
310
|
+
# python2.7 does not expose a proper API for exporting multiheaders
|
311
|
+
# efficiently. This function re-reads raw lines from the message
|
312
|
+
# object and extracts the multiheaders properly.
|
313
|
+
headers = []
|
314
|
+
|
315
|
+
for line in message.headers:
|
316
|
+
if line.startswith((' ', '\t')):
|
317
|
+
key, value = headers[-1]
|
318
|
+
headers[-1] = (key, value + '\r\n' + line.rstrip())
|
319
|
+
continue
|
320
|
+
|
321
|
+
key, value = line.split(':', 1)
|
322
|
+
headers.append((key, value.strip()))
|
323
|
+
|
324
|
+
return cls(headers)
|
Binary file
|
@@ -0,0 +1,330 @@
|
|
1
|
+
from __future__ import absolute_import
|
2
|
+
import datetime
|
3
|
+
import logging
|
4
|
+
import os
|
5
|
+
import sys
|
6
|
+
import socket
|
7
|
+
from socket import error as SocketError, timeout as SocketTimeout
|
8
|
+
import warnings
|
9
|
+
from .packages import six
|
10
|
+
|
11
|
+
try: # Python 3
|
12
|
+
from http.client import HTTPConnection as _HTTPConnection
|
13
|
+
from http.client import HTTPException # noqa: unused in this module
|
14
|
+
except ImportError:
|
15
|
+
from httplib import HTTPConnection as _HTTPConnection
|
16
|
+
from httplib import HTTPException # noqa: unused in this module
|
17
|
+
|
18
|
+
try: # Compiled with SSL?
|
19
|
+
import ssl
|
20
|
+
BaseSSLError = ssl.SSLError
|
21
|
+
except (ImportError, AttributeError): # Platform-specific: No SSL.
|
22
|
+
ssl = None
|
23
|
+
|
24
|
+
class BaseSSLError(BaseException):
|
25
|
+
pass
|
26
|
+
|
27
|
+
|
28
|
+
try: # Python 3:
|
29
|
+
# Not a no-op, we're adding this to the namespace so it can be imported.
|
30
|
+
ConnectionError = ConnectionError
|
31
|
+
except NameError: # Python 2:
|
32
|
+
class ConnectionError(Exception):
|
33
|
+
pass
|
34
|
+
|
35
|
+
|
36
|
+
from .exceptions import (
|
37
|
+
NewConnectionError,
|
38
|
+
ConnectTimeoutError,
|
39
|
+
SubjectAltNameWarning,
|
40
|
+
SystemTimeWarning,
|
41
|
+
)
|
42
|
+
from .packages.ssl_match_hostname import match_hostname, CertificateError
|
43
|
+
|
44
|
+
from .util.ssl_ import (
|
45
|
+
resolve_cert_reqs,
|
46
|
+
resolve_ssl_version,
|
47
|
+
ssl_wrap_socket,
|
48
|
+
assert_fingerprint,
|
49
|
+
)
|
50
|
+
|
51
|
+
|
52
|
+
from .util import connection
|
53
|
+
|
54
|
+
from ._collections import HTTPHeaderDict
|
55
|
+
|
56
|
+
log = logging.getLogger(__name__)
|
57
|
+
|
58
|
+
port_by_scheme = {
|
59
|
+
'http': 80,
|
60
|
+
'https': 443,
|
61
|
+
}
|
62
|
+
|
63
|
+
RECENT_DATE = datetime.date(2014, 1, 1)
|
64
|
+
|
65
|
+
|
66
|
+
class DummyConnection(object):
|
67
|
+
"""Used to detect a failed ConnectionCls import."""
|
68
|
+
pass
|
69
|
+
|
70
|
+
|
71
|
+
class HTTPConnection(_HTTPConnection, object):
|
72
|
+
"""
|
73
|
+
Based on httplib.HTTPConnection but provides an extra constructor
|
74
|
+
backwards-compatibility layer between older and newer Pythons.
|
75
|
+
|
76
|
+
Additional keyword parameters are used to configure attributes of the connection.
|
77
|
+
Accepted parameters include:
|
78
|
+
|
79
|
+
- ``strict``: See the documentation on :class:`urllib3.connectionpool.HTTPConnectionPool`
|
80
|
+
- ``source_address``: Set the source address for the current connection.
|
81
|
+
|
82
|
+
.. note:: This is ignored for Python 2.6. It is only applied for 2.7 and 3.x
|
83
|
+
|
84
|
+
- ``socket_options``: Set specific options on the underlying socket. If not specified, then
|
85
|
+
defaults are loaded from ``HTTPConnection.default_socket_options`` which includes disabling
|
86
|
+
Nagle's algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy.
|
87
|
+
|
88
|
+
For example, if you wish to enable TCP Keep Alive in addition to the defaults,
|
89
|
+
you might pass::
|
90
|
+
|
91
|
+
HTTPConnection.default_socket_options + [
|
92
|
+
(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1),
|
93
|
+
]
|
94
|
+
|
95
|
+
Or you may want to disable the defaults by passing an empty list (e.g., ``[]``).
|
96
|
+
"""
|
97
|
+
|
98
|
+
default_port = port_by_scheme['http']
|
99
|
+
|
100
|
+
#: Disable Nagle's algorithm by default.
|
101
|
+
#: ``[(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)]``
|
102
|
+
default_socket_options = [(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)]
|
103
|
+
|
104
|
+
#: Whether this connection verifies the host's certificate.
|
105
|
+
is_verified = False
|
106
|
+
|
107
|
+
def __init__(self, *args, **kw):
|
108
|
+
if six.PY3: # Python 3
|
109
|
+
kw.pop('strict', None)
|
110
|
+
|
111
|
+
# Pre-set source_address in case we have an older Python like 2.6.
|
112
|
+
self.source_address = kw.get('source_address')
|
113
|
+
|
114
|
+
if sys.version_info < (2, 7): # Python 2.6
|
115
|
+
# _HTTPConnection on Python 2.6 will balk at this keyword arg, but
|
116
|
+
# not newer versions. We can still use it when creating a
|
117
|
+
# connection though, so we pop it *after* we have saved it as
|
118
|
+
# self.source_address.
|
119
|
+
kw.pop('source_address', None)
|
120
|
+
|
121
|
+
#: The socket options provided by the user. If no options are
|
122
|
+
#: provided, we use the default options.
|
123
|
+
self.socket_options = kw.pop('socket_options', self.default_socket_options)
|
124
|
+
|
125
|
+
# Superclass also sets self.source_address in Python 2.7+.
|
126
|
+
_HTTPConnection.__init__(self, *args, **kw)
|
127
|
+
|
128
|
+
def _new_conn(self):
|
129
|
+
""" Establish a socket connection and set nodelay settings on it.
|
130
|
+
|
131
|
+
:return: New socket connection.
|
132
|
+
"""
|
133
|
+
extra_kw = {}
|
134
|
+
if self.source_address:
|
135
|
+
extra_kw['source_address'] = self.source_address
|
136
|
+
|
137
|
+
if self.socket_options:
|
138
|
+
extra_kw['socket_options'] = self.socket_options
|
139
|
+
|
140
|
+
try:
|
141
|
+
conn = connection.create_connection(
|
142
|
+
(self.host, self.port), self.timeout, **extra_kw)
|
143
|
+
|
144
|
+
except SocketTimeout as e:
|
145
|
+
raise ConnectTimeoutError(
|
146
|
+
self, "Connection to %s timed out. (connect timeout=%s)" %
|
147
|
+
(self.host, self.timeout))
|
148
|
+
|
149
|
+
except SocketError as e:
|
150
|
+
raise NewConnectionError(
|
151
|
+
self, "Failed to establish a new connection: %s" % e)
|
152
|
+
|
153
|
+
return conn
|
154
|
+
|
155
|
+
def _prepare_conn(self, conn):
|
156
|
+
self.sock = conn
|
157
|
+
# the _tunnel_host attribute was added in python 2.6.3 (via
|
158
|
+
# http://hg.python.org/cpython/rev/0f57b30a152f) so pythons 2.6(0-2) do
|
159
|
+
# not have them.
|
160
|
+
if getattr(self, '_tunnel_host', None):
|
161
|
+
# TODO: Fix tunnel so it doesn't depend on self.sock state.
|
162
|
+
self._tunnel()
|
163
|
+
# Mark this connection as not reusable
|
164
|
+
self.auto_open = 0
|
165
|
+
|
166
|
+
def connect(self):
|
167
|
+
conn = self._new_conn()
|
168
|
+
self._prepare_conn(conn)
|
169
|
+
|
170
|
+
def request_chunked(self, method, url, body=None, headers=None):
|
171
|
+
"""
|
172
|
+
Alternative to the common request method, which sends the
|
173
|
+
body with chunked encoding and not as one block
|
174
|
+
"""
|
175
|
+
headers = HTTPHeaderDict(headers if headers is not None else {})
|
176
|
+
skip_accept_encoding = 'accept-encoding' in headers
|
177
|
+
self.putrequest(method, url, skip_accept_encoding=skip_accept_encoding)
|
178
|
+
for header, value in headers.items():
|
179
|
+
self.putheader(header, value)
|
180
|
+
if 'transfer-encoding' not in headers:
|
181
|
+
self.putheader('Transfer-Encoding', 'chunked')
|
182
|
+
self.endheaders()
|
183
|
+
|
184
|
+
if body is not None:
|
185
|
+
stringish_types = six.string_types + (six.binary_type,)
|
186
|
+
if isinstance(body, stringish_types):
|
187
|
+
body = (body,)
|
188
|
+
for chunk in body:
|
189
|
+
if not chunk:
|
190
|
+
continue
|
191
|
+
if not isinstance(chunk, six.binary_type):
|
192
|
+
chunk = chunk.encode('utf8')
|
193
|
+
len_str = hex(len(chunk))[2:]
|
194
|
+
self.send(len_str.encode('utf-8'))
|
195
|
+
self.send(b'\r\n')
|
196
|
+
self.send(chunk)
|
197
|
+
self.send(b'\r\n')
|
198
|
+
|
199
|
+
# After the if clause, to always have a closed body
|
200
|
+
self.send(b'0\r\n\r\n')
|
201
|
+
|
202
|
+
|
203
|
+
class HTTPSConnection(HTTPConnection):
|
204
|
+
default_port = port_by_scheme['https']
|
205
|
+
|
206
|
+
def __init__(self, host, port=None, key_file=None, cert_file=None,
|
207
|
+
strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, **kw):
|
208
|
+
|
209
|
+
HTTPConnection.__init__(self, host, port, strict=strict,
|
210
|
+
timeout=timeout, **kw)
|
211
|
+
|
212
|
+
self.key_file = key_file
|
213
|
+
self.cert_file = cert_file
|
214
|
+
|
215
|
+
# Required property for Google AppEngine 1.9.0 which otherwise causes
|
216
|
+
# HTTPS requests to go out as HTTP. (See Issue #356)
|
217
|
+
self._protocol = 'https'
|
218
|
+
|
219
|
+
def connect(self):
|
220
|
+
conn = self._new_conn()
|
221
|
+
self._prepare_conn(conn)
|
222
|
+
self.sock = ssl.wrap_socket(conn, self.key_file, self.cert_file)
|
223
|
+
|
224
|
+
|
225
|
+
class VerifiedHTTPSConnection(HTTPSConnection):
|
226
|
+
"""
|
227
|
+
Based on httplib.HTTPSConnection but wraps the socket with
|
228
|
+
SSL certification.
|
229
|
+
"""
|
230
|
+
cert_reqs = None
|
231
|
+
ca_certs = None
|
232
|
+
ca_cert_dir = None
|
233
|
+
ssl_version = None
|
234
|
+
assert_fingerprint = None
|
235
|
+
|
236
|
+
def set_cert(self, key_file=None, cert_file=None,
|
237
|
+
cert_reqs=None, ca_certs=None,
|
238
|
+
assert_hostname=None, assert_fingerprint=None,
|
239
|
+
ca_cert_dir=None):
|
240
|
+
|
241
|
+
if (ca_certs or ca_cert_dir) and cert_reqs is None:
|
242
|
+
cert_reqs = 'CERT_REQUIRED'
|
243
|
+
|
244
|
+
self.key_file = key_file
|
245
|
+
self.cert_file = cert_file
|
246
|
+
self.cert_reqs = cert_reqs
|
247
|
+
self.assert_hostname = assert_hostname
|
248
|
+
self.assert_fingerprint = assert_fingerprint
|
249
|
+
self.ca_certs = ca_certs and os.path.expanduser(ca_certs)
|
250
|
+
self.ca_cert_dir = ca_cert_dir and os.path.expanduser(ca_cert_dir)
|
251
|
+
|
252
|
+
def connect(self):
|
253
|
+
# Add certificate verification
|
254
|
+
conn = self._new_conn()
|
255
|
+
|
256
|
+
resolved_cert_reqs = resolve_cert_reqs(self.cert_reqs)
|
257
|
+
resolved_ssl_version = resolve_ssl_version(self.ssl_version)
|
258
|
+
|
259
|
+
hostname = self.host
|
260
|
+
if getattr(self, '_tunnel_host', None):
|
261
|
+
# _tunnel_host was added in Python 2.6.3
|
262
|
+
# (See: http://hg.python.org/cpython/rev/0f57b30a152f)
|
263
|
+
|
264
|
+
self.sock = conn
|
265
|
+
# Calls self._set_hostport(), so self.host is
|
266
|
+
# self._tunnel_host below.
|
267
|
+
self._tunnel()
|
268
|
+
# Mark this connection as not reusable
|
269
|
+
self.auto_open = 0
|
270
|
+
|
271
|
+
# Override the host with the one we're requesting data from.
|
272
|
+
hostname = self._tunnel_host
|
273
|
+
|
274
|
+
is_time_off = datetime.date.today() < RECENT_DATE
|
275
|
+
if is_time_off:
|
276
|
+
warnings.warn((
|
277
|
+
'System time is way off (before {0}). This will probably '
|
278
|
+
'lead to SSL verification errors').format(RECENT_DATE),
|
279
|
+
SystemTimeWarning
|
280
|
+
)
|
281
|
+
|
282
|
+
# Wrap socket using verification with the root certs in
|
283
|
+
# trusted_root_certs
|
284
|
+
self.sock = ssl_wrap_socket(conn, self.key_file, self.cert_file,
|
285
|
+
cert_reqs=resolved_cert_reqs,
|
286
|
+
ca_certs=self.ca_certs,
|
287
|
+
ca_cert_dir=self.ca_cert_dir,
|
288
|
+
server_hostname=hostname,
|
289
|
+
ssl_version=resolved_ssl_version)
|
290
|
+
|
291
|
+
if self.assert_fingerprint:
|
292
|
+
assert_fingerprint(self.sock.getpeercert(binary_form=True),
|
293
|
+
self.assert_fingerprint)
|
294
|
+
elif resolved_cert_reqs != ssl.CERT_NONE \
|
295
|
+
and self.assert_hostname is not False:
|
296
|
+
cert = self.sock.getpeercert()
|
297
|
+
if not cert.get('subjectAltName', ()):
|
298
|
+
warnings.warn((
|
299
|
+
'Certificate for {0} has no `subjectAltName`, falling back to check for a '
|
300
|
+
'`commonName` for now. This feature is being removed by major browsers and '
|
301
|
+
'deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 '
|
302
|
+
'for details.)'.format(hostname)),
|
303
|
+
SubjectAltNameWarning
|
304
|
+
)
|
305
|
+
_match_hostname(cert, self.assert_hostname or hostname)
|
306
|
+
|
307
|
+
self.is_verified = (resolved_cert_reqs == ssl.CERT_REQUIRED or
|
308
|
+
self.assert_fingerprint is not None)
|
309
|
+
|
310
|
+
|
311
|
+
def _match_hostname(cert, asserted_hostname):
|
312
|
+
try:
|
313
|
+
match_hostname(cert, asserted_hostname)
|
314
|
+
except CertificateError as e:
|
315
|
+
log.error(
|
316
|
+
'Certificate did not match expected hostname: %s. '
|
317
|
+
'Certificate: %s', asserted_hostname, cert
|
318
|
+
)
|
319
|
+
# Add cert to exception and reraise so client code can inspect
|
320
|
+
# the cert when catching the exception, if they want to
|
321
|
+
e._peer_cert = cert
|
322
|
+
raise
|
323
|
+
|
324
|
+
|
325
|
+
if ssl:
|
326
|
+
# Make a copy for testing.
|
327
|
+
UnverifiedHTTPSConnection = HTTPSConnection
|
328
|
+
HTTPSConnection = VerifiedHTTPSConnection
|
329
|
+
else:
|
330
|
+
HTTPSConnection = DummyConnection
|
Binary file
|