cli-ih 0.6.2.1__py3-none-any.whl → 0.6.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cli_ih/asyncClient.py +51 -21
- cli_ih/client.py +14 -7
- {cli_ih-0.6.2.1.dist-info → cli_ih-0.6.3.1.dist-info}/METADATA +1 -1
- cli_ih-0.6.3.1.dist-info/RECORD +425 -0
- {cli_ih-0.6.2.1.dist-info → cli_ih-0.6.3.1.dist-info}/WHEEL +1 -1
- {cli_ih-0.6.2.1.dist-info → cli_ih-0.6.3.1.dist-info}/top_level.txt +1 -0
- venv/Lib/site-packages/__editable___cli_ih_0_6_3_1_finder.py +85 -0
- venv/Lib/site-packages/pip/__init__.py +13 -0
- venv/Lib/site-packages/pip/__main__.py +24 -0
- venv/Lib/site-packages/pip/__pip-runner__.py +50 -0
- venv/Lib/site-packages/pip/_internal/__init__.py +18 -0
- venv/Lib/site-packages/pip/_internal/build_env.py +349 -0
- venv/Lib/site-packages/pip/_internal/cache.py +291 -0
- venv/Lib/site-packages/pip/_internal/cli/__init__.py +3 -0
- venv/Lib/site-packages/pip/_internal/cli/autocompletion.py +184 -0
- venv/Lib/site-packages/pip/_internal/cli/base_command.py +244 -0
- venv/Lib/site-packages/pip/_internal/cli/cmdoptions.py +1138 -0
- venv/Lib/site-packages/pip/_internal/cli/command_context.py +28 -0
- venv/Lib/site-packages/pip/_internal/cli/index_command.py +175 -0
- venv/Lib/site-packages/pip/_internal/cli/main.py +80 -0
- venv/Lib/site-packages/pip/_internal/cli/main_parser.py +134 -0
- venv/Lib/site-packages/pip/_internal/cli/parser.py +298 -0
- venv/Lib/site-packages/pip/_internal/cli/progress_bars.py +151 -0
- venv/Lib/site-packages/pip/_internal/cli/req_command.py +351 -0
- venv/Lib/site-packages/pip/_internal/cli/spinners.py +235 -0
- venv/Lib/site-packages/pip/_internal/cli/status_codes.py +6 -0
- venv/Lib/site-packages/pip/_internal/commands/__init__.py +139 -0
- venv/Lib/site-packages/pip/_internal/commands/cache.py +231 -0
- venv/Lib/site-packages/pip/_internal/commands/check.py +66 -0
- venv/Lib/site-packages/pip/_internal/commands/completion.py +135 -0
- venv/Lib/site-packages/pip/_internal/commands/configuration.py +288 -0
- venv/Lib/site-packages/pip/_internal/commands/debug.py +203 -0
- venv/Lib/site-packages/pip/_internal/commands/download.py +145 -0
- venv/Lib/site-packages/pip/_internal/commands/freeze.py +107 -0
- venv/Lib/site-packages/pip/_internal/commands/hash.py +58 -0
- venv/Lib/site-packages/pip/_internal/commands/help.py +40 -0
- venv/Lib/site-packages/pip/_internal/commands/index.py +159 -0
- venv/Lib/site-packages/pip/_internal/commands/inspect.py +92 -0
- venv/Lib/site-packages/pip/_internal/commands/install.py +798 -0
- venv/Lib/site-packages/pip/_internal/commands/list.py +400 -0
- venv/Lib/site-packages/pip/_internal/commands/lock.py +170 -0
- venv/Lib/site-packages/pip/_internal/commands/search.py +178 -0
- venv/Lib/site-packages/pip/_internal/commands/show.py +231 -0
- venv/Lib/site-packages/pip/_internal/commands/uninstall.py +113 -0
- venv/Lib/site-packages/pip/_internal/commands/wheel.py +181 -0
- venv/Lib/site-packages/pip/_internal/configuration.py +397 -0
- venv/Lib/site-packages/pip/_internal/distributions/__init__.py +21 -0
- venv/Lib/site-packages/pip/_internal/distributions/base.py +55 -0
- venv/Lib/site-packages/pip/_internal/distributions/installed.py +33 -0
- venv/Lib/site-packages/pip/_internal/distributions/sdist.py +165 -0
- venv/Lib/site-packages/pip/_internal/distributions/wheel.py +44 -0
- venv/Lib/site-packages/pip/_internal/exceptions.py +881 -0
- venv/Lib/site-packages/pip/_internal/index/__init__.py +1 -0
- venv/Lib/site-packages/pip/_internal/index/collector.py +489 -0
- venv/Lib/site-packages/pip/_internal/index/package_finder.py +1059 -0
- venv/Lib/site-packages/pip/_internal/index/sources.py +287 -0
- venv/Lib/site-packages/pip/_internal/locations/__init__.py +441 -0
- venv/Lib/site-packages/pip/_internal/locations/_distutils.py +173 -0
- venv/Lib/site-packages/pip/_internal/locations/_sysconfig.py +215 -0
- venv/Lib/site-packages/pip/_internal/locations/base.py +82 -0
- venv/Lib/site-packages/pip/_internal/main.py +12 -0
- venv/Lib/site-packages/pip/_internal/metadata/__init__.py +164 -0
- venv/Lib/site-packages/pip/_internal/metadata/_json.py +87 -0
- venv/Lib/site-packages/pip/_internal/metadata/base.py +685 -0
- venv/Lib/site-packages/pip/_internal/metadata/importlib/__init__.py +6 -0
- venv/Lib/site-packages/pip/_internal/metadata/importlib/_compat.py +87 -0
- venv/Lib/site-packages/pip/_internal/metadata/importlib/_dists.py +223 -0
- venv/Lib/site-packages/pip/_internal/metadata/importlib/_envs.py +143 -0
- venv/Lib/site-packages/pip/_internal/metadata/pkg_resources.py +298 -0
- venv/Lib/site-packages/pip/_internal/models/__init__.py +1 -0
- venv/Lib/site-packages/pip/_internal/models/candidate.py +25 -0
- venv/Lib/site-packages/pip/_internal/models/direct_url.py +227 -0
- venv/Lib/site-packages/pip/_internal/models/format_control.py +78 -0
- venv/Lib/site-packages/pip/_internal/models/index.py +28 -0
- venv/Lib/site-packages/pip/_internal/models/installation_report.py +57 -0
- venv/Lib/site-packages/pip/_internal/models/link.py +613 -0
- venv/Lib/site-packages/pip/_internal/models/pylock.py +188 -0
- venv/Lib/site-packages/pip/_internal/models/scheme.py +25 -0
- venv/Lib/site-packages/pip/_internal/models/search_scope.py +126 -0
- venv/Lib/site-packages/pip/_internal/models/selection_prefs.py +53 -0
- venv/Lib/site-packages/pip/_internal/models/target_python.py +122 -0
- venv/Lib/site-packages/pip/_internal/models/wheel.py +141 -0
- venv/Lib/site-packages/pip/_internal/network/__init__.py +1 -0
- venv/Lib/site-packages/pip/_internal/network/auth.py +564 -0
- venv/Lib/site-packages/pip/_internal/network/cache.py +133 -0
- venv/Lib/site-packages/pip/_internal/network/download.py +342 -0
- venv/Lib/site-packages/pip/_internal/network/lazy_wheel.py +213 -0
- venv/Lib/site-packages/pip/_internal/network/session.py +528 -0
- venv/Lib/site-packages/pip/_internal/network/utils.py +98 -0
- venv/Lib/site-packages/pip/_internal/network/xmlrpc.py +61 -0
- venv/Lib/site-packages/pip/_internal/operations/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/operations/build/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/operations/build/build_tracker.py +140 -0
- venv/Lib/site-packages/pip/_internal/operations/build/metadata.py +38 -0
- venv/Lib/site-packages/pip/_internal/operations/build/metadata_editable.py +41 -0
- venv/Lib/site-packages/pip/_internal/operations/build/metadata_legacy.py +73 -0
- venv/Lib/site-packages/pip/_internal/operations/build/wheel.py +38 -0
- venv/Lib/site-packages/pip/_internal/operations/build/wheel_editable.py +47 -0
- venv/Lib/site-packages/pip/_internal/operations/build/wheel_legacy.py +119 -0
- venv/Lib/site-packages/pip/_internal/operations/check.py +175 -0
- venv/Lib/site-packages/pip/_internal/operations/freeze.py +259 -0
- venv/Lib/site-packages/pip/_internal/operations/install/__init__.py +1 -0
- venv/Lib/site-packages/pip/_internal/operations/install/editable_legacy.py +48 -0
- venv/Lib/site-packages/pip/_internal/operations/install/wheel.py +746 -0
- venv/Lib/site-packages/pip/_internal/operations/prepare.py +742 -0
- venv/Lib/site-packages/pip/_internal/pyproject.py +182 -0
- venv/Lib/site-packages/pip/_internal/req/__init__.py +105 -0
- venv/Lib/site-packages/pip/_internal/req/constructors.py +562 -0
- venv/Lib/site-packages/pip/_internal/req/req_dependency_group.py +75 -0
- venv/Lib/site-packages/pip/_internal/req/req_file.py +620 -0
- venv/Lib/site-packages/pip/_internal/req/req_install.py +937 -0
- venv/Lib/site-packages/pip/_internal/req/req_set.py +81 -0
- venv/Lib/site-packages/pip/_internal/req/req_uninstall.py +639 -0
- venv/Lib/site-packages/pip/_internal/resolution/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/resolution/base.py +20 -0
- venv/Lib/site-packages/pip/_internal/resolution/legacy/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/resolution/legacy/resolver.py +598 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/base.py +142 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/candidates.py +582 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/factory.py +814 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py +166 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/provider.py +276 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/reporter.py +85 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/requirements.py +247 -0
- venv/Lib/site-packages/pip/_internal/resolution/resolvelib/resolver.py +336 -0
- venv/Lib/site-packages/pip/_internal/self_outdated_check.py +254 -0
- venv/Lib/site-packages/pip/_internal/utils/__init__.py +0 -0
- venv/Lib/site-packages/pip/_internal/utils/_jaraco_text.py +109 -0
- venv/Lib/site-packages/pip/_internal/utils/_log.py +38 -0
- venv/Lib/site-packages/pip/_internal/utils/appdirs.py +52 -0
- venv/Lib/site-packages/pip/_internal/utils/compat.py +85 -0
- venv/Lib/site-packages/pip/_internal/utils/compatibility_tags.py +201 -0
- venv/Lib/site-packages/pip/_internal/utils/datetime.py +10 -0
- venv/Lib/site-packages/pip/_internal/utils/deprecation.py +126 -0
- venv/Lib/site-packages/pip/_internal/utils/direct_url_helpers.py +87 -0
- venv/Lib/site-packages/pip/_internal/utils/egg_link.py +81 -0
- venv/Lib/site-packages/pip/_internal/utils/entrypoints.py +88 -0
- venv/Lib/site-packages/pip/_internal/utils/filesystem.py +152 -0
- venv/Lib/site-packages/pip/_internal/utils/filetypes.py +24 -0
- venv/Lib/site-packages/pip/_internal/utils/glibc.py +102 -0
- venv/Lib/site-packages/pip/_internal/utils/hashes.py +150 -0
- venv/Lib/site-packages/pip/_internal/utils/logging.py +364 -0
- venv/Lib/site-packages/pip/_internal/utils/misc.py +765 -0
- venv/Lib/site-packages/pip/_internal/utils/packaging.py +44 -0
- venv/Lib/site-packages/pip/_internal/utils/retry.py +45 -0
- venv/Lib/site-packages/pip/_internal/utils/setuptools_build.py +149 -0
- venv/Lib/site-packages/pip/_internal/utils/subprocess.py +248 -0
- venv/Lib/site-packages/pip/_internal/utils/temp_dir.py +294 -0
- venv/Lib/site-packages/pip/_internal/utils/unpacking.py +337 -0
- venv/Lib/site-packages/pip/_internal/utils/urls.py +55 -0
- venv/Lib/site-packages/pip/_internal/utils/virtualenv.py +105 -0
- venv/Lib/site-packages/pip/_internal/utils/wheel.py +132 -0
- venv/Lib/site-packages/pip/_internal/vcs/__init__.py +15 -0
- venv/Lib/site-packages/pip/_internal/vcs/bazaar.py +130 -0
- venv/Lib/site-packages/pip/_internal/vcs/git.py +571 -0
- venv/Lib/site-packages/pip/_internal/vcs/mercurial.py +186 -0
- venv/Lib/site-packages/pip/_internal/vcs/subversion.py +335 -0
- venv/Lib/site-packages/pip/_internal/vcs/versioncontrol.py +693 -0
- venv/Lib/site-packages/pip/_internal/wheel_builder.py +334 -0
- venv/Lib/site-packages/pip/_vendor/__init__.py +117 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/__init__.py +29 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/_cmd.py +70 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/adapter.py +168 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/cache.py +75 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +8 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +145 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +48 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/controller.py +511 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/filewrapper.py +119 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/heuristics.py +157 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/serialize.py +146 -0
- venv/Lib/site-packages/pip/_vendor/cachecontrol/wrapper.py +43 -0
- venv/Lib/site-packages/pip/_vendor/certifi/__init__.py +4 -0
- venv/Lib/site-packages/pip/_vendor/certifi/__main__.py +12 -0
- venv/Lib/site-packages/pip/_vendor/certifi/core.py +83 -0
- venv/Lib/site-packages/pip/_vendor/certifi/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/__init__.py +13 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/__main__.py +65 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/_implementation.py +209 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/_lint_dependency_groups.py +59 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/_pip_wrapper.py +62 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/_toml_compat.py +9 -0
- venv/Lib/site-packages/pip/_vendor/dependency_groups/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/distlib/__init__.py +33 -0
- venv/Lib/site-packages/pip/_vendor/distlib/compat.py +1137 -0
- venv/Lib/site-packages/pip/_vendor/distlib/resources.py +358 -0
- venv/Lib/site-packages/pip/_vendor/distlib/scripts.py +447 -0
- venv/Lib/site-packages/pip/_vendor/distlib/util.py +1984 -0
- venv/Lib/site-packages/pip/_vendor/distro/__init__.py +54 -0
- venv/Lib/site-packages/pip/_vendor/distro/__main__.py +4 -0
- venv/Lib/site-packages/pip/_vendor/distro/distro.py +1403 -0
- venv/Lib/site-packages/pip/_vendor/distro/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/idna/__init__.py +45 -0
- venv/Lib/site-packages/pip/_vendor/idna/codec.py +122 -0
- venv/Lib/site-packages/pip/_vendor/idna/compat.py +15 -0
- venv/Lib/site-packages/pip/_vendor/idna/core.py +437 -0
- venv/Lib/site-packages/pip/_vendor/idna/idnadata.py +4243 -0
- venv/Lib/site-packages/pip/_vendor/idna/intranges.py +57 -0
- venv/Lib/site-packages/pip/_vendor/idna/package_data.py +1 -0
- venv/Lib/site-packages/pip/_vendor/idna/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/idna/uts46data.py +8681 -0
- venv/Lib/site-packages/pip/_vendor/msgpack/__init__.py +55 -0
- venv/Lib/site-packages/pip/_vendor/msgpack/exceptions.py +48 -0
- venv/Lib/site-packages/pip/_vendor/msgpack/ext.py +170 -0
- venv/Lib/site-packages/pip/_vendor/msgpack/fallback.py +929 -0
- venv/Lib/site-packages/pip/_vendor/packaging/__init__.py +15 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_elffile.py +109 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_manylinux.py +262 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_musllinux.py +85 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_parser.py +353 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_structures.py +61 -0
- venv/Lib/site-packages/pip/_vendor/packaging/_tokenizer.py +195 -0
- venv/Lib/site-packages/pip/_vendor/packaging/licenses/__init__.py +145 -0
- venv/Lib/site-packages/pip/_vendor/packaging/licenses/_spdx.py +759 -0
- venv/Lib/site-packages/pip/_vendor/packaging/markers.py +362 -0
- venv/Lib/site-packages/pip/_vendor/packaging/metadata.py +862 -0
- venv/Lib/site-packages/pip/_vendor/packaging/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/packaging/requirements.py +91 -0
- venv/Lib/site-packages/pip/_vendor/packaging/specifiers.py +1019 -0
- venv/Lib/site-packages/pip/_vendor/packaging/tags.py +656 -0
- venv/Lib/site-packages/pip/_vendor/packaging/utils.py +163 -0
- venv/Lib/site-packages/pip/_vendor/packaging/version.py +582 -0
- venv/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py +3676 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/__init__.py +631 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/__main__.py +55 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/android.py +249 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/api.py +299 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/macos.py +144 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/unix.py +272 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/version.py +21 -0
- venv/Lib/site-packages/pip/_vendor/platformdirs/windows.py +272 -0
- venv/Lib/site-packages/pip/_vendor/pygments/__init__.py +82 -0
- venv/Lib/site-packages/pip/_vendor/pygments/__main__.py +17 -0
- venv/Lib/site-packages/pip/_vendor/pygments/console.py +70 -0
- venv/Lib/site-packages/pip/_vendor/pygments/filter.py +70 -0
- venv/Lib/site-packages/pip/_vendor/pygments/filters/__init__.py +940 -0
- venv/Lib/site-packages/pip/_vendor/pygments/formatter.py +129 -0
- venv/Lib/site-packages/pip/_vendor/pygments/formatters/__init__.py +157 -0
- venv/Lib/site-packages/pip/_vendor/pygments/formatters/_mapping.py +23 -0
- venv/Lib/site-packages/pip/_vendor/pygments/lexer.py +963 -0
- venv/Lib/site-packages/pip/_vendor/pygments/lexers/__init__.py +362 -0
- venv/Lib/site-packages/pip/_vendor/pygments/lexers/_mapping.py +602 -0
- venv/Lib/site-packages/pip/_vendor/pygments/lexers/python.py +1201 -0
- venv/Lib/site-packages/pip/_vendor/pygments/modeline.py +43 -0
- venv/Lib/site-packages/pip/_vendor/pygments/plugin.py +72 -0
- venv/Lib/site-packages/pip/_vendor/pygments/regexopt.py +91 -0
- venv/Lib/site-packages/pip/_vendor/pygments/scanner.py +104 -0
- venv/Lib/site-packages/pip/_vendor/pygments/sphinxext.py +247 -0
- venv/Lib/site-packages/pip/_vendor/pygments/style.py +203 -0
- venv/Lib/site-packages/pip/_vendor/pygments/styles/__init__.py +61 -0
- venv/Lib/site-packages/pip/_vendor/pygments/styles/_mapping.py +54 -0
- venv/Lib/site-packages/pip/_vendor/pygments/token.py +214 -0
- venv/Lib/site-packages/pip/_vendor/pygments/unistring.py +153 -0
- venv/Lib/site-packages/pip/_vendor/pygments/util.py +324 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/__init__.py +31 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_impl.py +410 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/__init__.py +21 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py +389 -0
- venv/Lib/site-packages/pip/_vendor/pyproject_hooks/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/requests/__init__.py +179 -0
- venv/Lib/site-packages/pip/_vendor/requests/__version__.py +14 -0
- venv/Lib/site-packages/pip/_vendor/requests/_internal_utils.py +50 -0
- venv/Lib/site-packages/pip/_vendor/requests/adapters.py +719 -0
- venv/Lib/site-packages/pip/_vendor/requests/api.py +157 -0
- venv/Lib/site-packages/pip/_vendor/requests/auth.py +314 -0
- venv/Lib/site-packages/pip/_vendor/requests/certs.py +17 -0
- venv/Lib/site-packages/pip/_vendor/requests/compat.py +90 -0
- venv/Lib/site-packages/pip/_vendor/requests/cookies.py +561 -0
- venv/Lib/site-packages/pip/_vendor/requests/exceptions.py +151 -0
- venv/Lib/site-packages/pip/_vendor/requests/help.py +127 -0
- venv/Lib/site-packages/pip/_vendor/requests/hooks.py +33 -0
- venv/Lib/site-packages/pip/_vendor/requests/models.py +1039 -0
- venv/Lib/site-packages/pip/_vendor/requests/packages.py +25 -0
- venv/Lib/site-packages/pip/_vendor/requests/sessions.py +831 -0
- venv/Lib/site-packages/pip/_vendor/requests/status_codes.py +128 -0
- venv/Lib/site-packages/pip/_vendor/requests/structures.py +99 -0
- venv/Lib/site-packages/pip/_vendor/requests/utils.py +1086 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/__init__.py +27 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/providers.py +196 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/reporters.py +55 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/__init__.py +27 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/abstract.py +47 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/criterion.py +48 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/exceptions.py +57 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers/resolution.py +622 -0
- venv/Lib/site-packages/pip/_vendor/resolvelib/structs.py +209 -0
- venv/Lib/site-packages/pip/_vendor/rich/__init__.py +177 -0
- venv/Lib/site-packages/pip/_vendor/rich/__main__.py +245 -0
- venv/Lib/site-packages/pip/_vendor/rich/_cell_widths.py +454 -0
- venv/Lib/site-packages/pip/_vendor/rich/_emoji_codes.py +3610 -0
- venv/Lib/site-packages/pip/_vendor/rich/_emoji_replace.py +32 -0
- venv/Lib/site-packages/pip/_vendor/rich/_export_format.py +76 -0
- venv/Lib/site-packages/pip/_vendor/rich/_extension.py +10 -0
- venv/Lib/site-packages/pip/_vendor/rich/_fileno.py +24 -0
- venv/Lib/site-packages/pip/_vendor/rich/_inspect.py +268 -0
- venv/Lib/site-packages/pip/_vendor/rich/_log_render.py +94 -0
- venv/Lib/site-packages/pip/_vendor/rich/_loop.py +43 -0
- venv/Lib/site-packages/pip/_vendor/rich/_null_file.py +69 -0
- venv/Lib/site-packages/pip/_vendor/rich/_palettes.py +309 -0
- venv/Lib/site-packages/pip/_vendor/rich/_pick.py +17 -0
- venv/Lib/site-packages/pip/_vendor/rich/_ratio.py +153 -0
- venv/Lib/site-packages/pip/_vendor/rich/_spinners.py +482 -0
- venv/Lib/site-packages/pip/_vendor/rich/_stack.py +16 -0
- venv/Lib/site-packages/pip/_vendor/rich/_timer.py +19 -0
- venv/Lib/site-packages/pip/_vendor/rich/_win32_console.py +661 -0
- venv/Lib/site-packages/pip/_vendor/rich/_windows.py +71 -0
- venv/Lib/site-packages/pip/_vendor/rich/_windows_renderer.py +56 -0
- venv/Lib/site-packages/pip/_vendor/rich/_wrap.py +93 -0
- venv/Lib/site-packages/pip/_vendor/rich/abc.py +33 -0
- venv/Lib/site-packages/pip/_vendor/rich/align.py +306 -0
- venv/Lib/site-packages/pip/_vendor/rich/ansi.py +241 -0
- venv/Lib/site-packages/pip/_vendor/rich/bar.py +93 -0
- venv/Lib/site-packages/pip/_vendor/rich/box.py +474 -0
- venv/Lib/site-packages/pip/_vendor/rich/cells.py +174 -0
- venv/Lib/site-packages/pip/_vendor/rich/color.py +621 -0
- venv/Lib/site-packages/pip/_vendor/rich/color_triplet.py +38 -0
- venv/Lib/site-packages/pip/_vendor/rich/columns.py +187 -0
- venv/Lib/site-packages/pip/_vendor/rich/console.py +2680 -0
- venv/Lib/site-packages/pip/_vendor/rich/constrain.py +37 -0
- venv/Lib/site-packages/pip/_vendor/rich/containers.py +167 -0
- venv/Lib/site-packages/pip/_vendor/rich/control.py +219 -0
- venv/Lib/site-packages/pip/_vendor/rich/default_styles.py +193 -0
- venv/Lib/site-packages/pip/_vendor/rich/diagnose.py +39 -0
- venv/Lib/site-packages/pip/_vendor/rich/emoji.py +91 -0
- venv/Lib/site-packages/pip/_vendor/rich/errors.py +34 -0
- venv/Lib/site-packages/pip/_vendor/rich/file_proxy.py +57 -0
- venv/Lib/site-packages/pip/_vendor/rich/filesize.py +88 -0
- venv/Lib/site-packages/pip/_vendor/rich/highlighter.py +232 -0
- venv/Lib/site-packages/pip/_vendor/rich/json.py +139 -0
- venv/Lib/site-packages/pip/_vendor/rich/jupyter.py +101 -0
- venv/Lib/site-packages/pip/_vendor/rich/layout.py +442 -0
- venv/Lib/site-packages/pip/_vendor/rich/live.py +400 -0
- venv/Lib/site-packages/pip/_vendor/rich/live_render.py +106 -0
- venv/Lib/site-packages/pip/_vendor/rich/logging.py +297 -0
- venv/Lib/site-packages/pip/_vendor/rich/markup.py +251 -0
- venv/Lib/site-packages/pip/_vendor/rich/measure.py +151 -0
- venv/Lib/site-packages/pip/_vendor/rich/padding.py +141 -0
- venv/Lib/site-packages/pip/_vendor/rich/pager.py +34 -0
- venv/Lib/site-packages/pip/_vendor/rich/palette.py +100 -0
- venv/Lib/site-packages/pip/_vendor/rich/panel.py +317 -0
- venv/Lib/site-packages/pip/_vendor/rich/pretty.py +1016 -0
- venv/Lib/site-packages/pip/_vendor/rich/progress.py +1715 -0
- venv/Lib/site-packages/pip/_vendor/rich/progress_bar.py +223 -0
- venv/Lib/site-packages/pip/_vendor/rich/prompt.py +400 -0
- venv/Lib/site-packages/pip/_vendor/rich/protocol.py +42 -0
- venv/Lib/site-packages/pip/_vendor/rich/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/rich/region.py +10 -0
- venv/Lib/site-packages/pip/_vendor/rich/repr.py +149 -0
- venv/Lib/site-packages/pip/_vendor/rich/rule.py +130 -0
- venv/Lib/site-packages/pip/_vendor/rich/scope.py +86 -0
- venv/Lib/site-packages/pip/_vendor/rich/screen.py +54 -0
- venv/Lib/site-packages/pip/_vendor/rich/segment.py +752 -0
- venv/Lib/site-packages/pip/_vendor/rich/spinner.py +132 -0
- venv/Lib/site-packages/pip/_vendor/rich/status.py +131 -0
- venv/Lib/site-packages/pip/_vendor/rich/style.py +796 -0
- venv/Lib/site-packages/pip/_vendor/rich/styled.py +42 -0
- venv/Lib/site-packages/pip/_vendor/rich/syntax.py +985 -0
- venv/Lib/site-packages/pip/_vendor/rich/table.py +1006 -0
- venv/Lib/site-packages/pip/_vendor/rich/terminal_theme.py +153 -0
- venv/Lib/site-packages/pip/_vendor/rich/text.py +1361 -0
- venv/Lib/site-packages/pip/_vendor/rich/theme.py +115 -0
- venv/Lib/site-packages/pip/_vendor/rich/themes.py +5 -0
- venv/Lib/site-packages/pip/_vendor/rich/traceback.py +899 -0
- venv/Lib/site-packages/pip/_vendor/rich/tree.py +257 -0
- venv/Lib/site-packages/pip/_vendor/tomli/__init__.py +8 -0
- venv/Lib/site-packages/pip/_vendor/tomli/_parser.py +770 -0
- venv/Lib/site-packages/pip/_vendor/tomli/_re.py +112 -0
- venv/Lib/site-packages/pip/_vendor/tomli/_types.py +10 -0
- venv/Lib/site-packages/pip/_vendor/tomli/py.typed +1 -0
- venv/Lib/site-packages/pip/_vendor/tomli_w/__init__.py +4 -0
- venv/Lib/site-packages/pip/_vendor/tomli_w/_writer.py +229 -0
- venv/Lib/site-packages/pip/_vendor/tomli_w/py.typed +1 -0
- venv/Lib/site-packages/pip/_vendor/truststore/__init__.py +36 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_api.py +333 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_macos.py +571 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_openssl.py +66 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_ssl_constants.py +31 -0
- venv/Lib/site-packages/pip/_vendor/truststore/_windows.py +567 -0
- venv/Lib/site-packages/pip/_vendor/truststore/py.typed +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/__init__.py +102 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/_collections.py +355 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/_version.py +2 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/connection.py +572 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/connectionpool.py +1140 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_appengine_environ.py +36 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +519 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +397 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/appengine.py +314 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/ntlmpool.py +130 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +518 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +920 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/contrib/socks.py +216 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/exceptions.py +323 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/fields.py +274 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/filepost.py +98 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/__init__.py +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +51 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/backports/weakref_finalize.py +155 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/packages/six.py +1076 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/poolmanager.py +540 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/request.py +191 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/response.py +879 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/__init__.py +49 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/connection.py +149 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/proxy.py +57 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/queue.py +22 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/request.py +137 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/response.py +107 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/retry.py +622 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_.py +504 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/ssl_match_hostname.py +159 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/ssltransport.py +221 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/timeout.py +271 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/url.py +435 -0
- venv/Lib/site-packages/pip/_vendor/urllib3/util/wait.py +152 -0
- venv/Lib/site-packages/pip/py.typed +4 -0
- cli_ih-0.6.2.1.dist-info/RECORD +0 -8
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
import contextlib
|
|
2
|
+
import ssl
|
|
3
|
+
import typing
|
|
4
|
+
from ctypes import WinDLL # type: ignore
|
|
5
|
+
from ctypes import WinError # type: ignore
|
|
6
|
+
from ctypes import (
|
|
7
|
+
POINTER,
|
|
8
|
+
Structure,
|
|
9
|
+
c_char_p,
|
|
10
|
+
c_ulong,
|
|
11
|
+
c_void_p,
|
|
12
|
+
c_wchar_p,
|
|
13
|
+
cast,
|
|
14
|
+
create_unicode_buffer,
|
|
15
|
+
pointer,
|
|
16
|
+
sizeof,
|
|
17
|
+
)
|
|
18
|
+
from ctypes.wintypes import (
|
|
19
|
+
BOOL,
|
|
20
|
+
DWORD,
|
|
21
|
+
HANDLE,
|
|
22
|
+
LONG,
|
|
23
|
+
LPCSTR,
|
|
24
|
+
LPCVOID,
|
|
25
|
+
LPCWSTR,
|
|
26
|
+
LPFILETIME,
|
|
27
|
+
LPSTR,
|
|
28
|
+
LPWSTR,
|
|
29
|
+
)
|
|
30
|
+
from typing import TYPE_CHECKING, Any
|
|
31
|
+
|
|
32
|
+
from ._ssl_constants import _set_ssl_context_verify_mode
|
|
33
|
+
|
|
34
|
+
HCERTCHAINENGINE = HANDLE
|
|
35
|
+
HCERTSTORE = HANDLE
|
|
36
|
+
HCRYPTPROV_LEGACY = HANDLE
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class CERT_CONTEXT(Structure):
|
|
40
|
+
_fields_ = (
|
|
41
|
+
("dwCertEncodingType", DWORD),
|
|
42
|
+
("pbCertEncoded", c_void_p),
|
|
43
|
+
("cbCertEncoded", DWORD),
|
|
44
|
+
("pCertInfo", c_void_p),
|
|
45
|
+
("hCertStore", HCERTSTORE),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
PCERT_CONTEXT = POINTER(CERT_CONTEXT)
|
|
50
|
+
PCCERT_CONTEXT = POINTER(PCERT_CONTEXT)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class CERT_ENHKEY_USAGE(Structure):
|
|
54
|
+
_fields_ = (
|
|
55
|
+
("cUsageIdentifier", DWORD),
|
|
56
|
+
("rgpszUsageIdentifier", POINTER(LPSTR)),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
PCERT_ENHKEY_USAGE = POINTER(CERT_ENHKEY_USAGE)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class CERT_USAGE_MATCH(Structure):
|
|
64
|
+
_fields_ = (
|
|
65
|
+
("dwType", DWORD),
|
|
66
|
+
("Usage", CERT_ENHKEY_USAGE),
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class CERT_CHAIN_PARA(Structure):
|
|
71
|
+
_fields_ = (
|
|
72
|
+
("cbSize", DWORD),
|
|
73
|
+
("RequestedUsage", CERT_USAGE_MATCH),
|
|
74
|
+
("RequestedIssuancePolicy", CERT_USAGE_MATCH),
|
|
75
|
+
("dwUrlRetrievalTimeout", DWORD),
|
|
76
|
+
("fCheckRevocationFreshnessTime", BOOL),
|
|
77
|
+
("dwRevocationFreshnessTime", DWORD),
|
|
78
|
+
("pftCacheResync", LPFILETIME),
|
|
79
|
+
("pStrongSignPara", c_void_p),
|
|
80
|
+
("dwStrongSignFlags", DWORD),
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
if TYPE_CHECKING:
|
|
85
|
+
PCERT_CHAIN_PARA = pointer[CERT_CHAIN_PARA] # type: ignore[misc]
|
|
86
|
+
else:
|
|
87
|
+
PCERT_CHAIN_PARA = POINTER(CERT_CHAIN_PARA)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class CERT_TRUST_STATUS(Structure):
|
|
91
|
+
_fields_ = (
|
|
92
|
+
("dwErrorStatus", DWORD),
|
|
93
|
+
("dwInfoStatus", DWORD),
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class CERT_CHAIN_ELEMENT(Structure):
|
|
98
|
+
_fields_ = (
|
|
99
|
+
("cbSize", DWORD),
|
|
100
|
+
("pCertContext", PCERT_CONTEXT),
|
|
101
|
+
("TrustStatus", CERT_TRUST_STATUS),
|
|
102
|
+
("pRevocationInfo", c_void_p),
|
|
103
|
+
("pIssuanceUsage", PCERT_ENHKEY_USAGE),
|
|
104
|
+
("pApplicationUsage", PCERT_ENHKEY_USAGE),
|
|
105
|
+
("pwszExtendedErrorInfo", LPCWSTR),
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
PCERT_CHAIN_ELEMENT = POINTER(CERT_CHAIN_ELEMENT)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class CERT_SIMPLE_CHAIN(Structure):
|
|
113
|
+
_fields_ = (
|
|
114
|
+
("cbSize", DWORD),
|
|
115
|
+
("TrustStatus", CERT_TRUST_STATUS),
|
|
116
|
+
("cElement", DWORD),
|
|
117
|
+
("rgpElement", POINTER(PCERT_CHAIN_ELEMENT)),
|
|
118
|
+
("pTrustListInfo", c_void_p),
|
|
119
|
+
("fHasRevocationFreshnessTime", BOOL),
|
|
120
|
+
("dwRevocationFreshnessTime", DWORD),
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
PCERT_SIMPLE_CHAIN = POINTER(CERT_SIMPLE_CHAIN)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class CERT_CHAIN_CONTEXT(Structure):
|
|
128
|
+
_fields_ = (
|
|
129
|
+
("cbSize", DWORD),
|
|
130
|
+
("TrustStatus", CERT_TRUST_STATUS),
|
|
131
|
+
("cChain", DWORD),
|
|
132
|
+
("rgpChain", POINTER(PCERT_SIMPLE_CHAIN)),
|
|
133
|
+
("cLowerQualityChainContext", DWORD),
|
|
134
|
+
("rgpLowerQualityChainContext", c_void_p),
|
|
135
|
+
("fHasRevocationFreshnessTime", BOOL),
|
|
136
|
+
("dwRevocationFreshnessTime", DWORD),
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
PCERT_CHAIN_CONTEXT = POINTER(CERT_CHAIN_CONTEXT)
|
|
141
|
+
PCCERT_CHAIN_CONTEXT = POINTER(PCERT_CHAIN_CONTEXT)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
class SSL_EXTRA_CERT_CHAIN_POLICY_PARA(Structure):
|
|
145
|
+
_fields_ = (
|
|
146
|
+
("cbSize", DWORD),
|
|
147
|
+
("dwAuthType", DWORD),
|
|
148
|
+
("fdwChecks", DWORD),
|
|
149
|
+
("pwszServerName", LPCWSTR),
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class CERT_CHAIN_POLICY_PARA(Structure):
|
|
154
|
+
_fields_ = (
|
|
155
|
+
("cbSize", DWORD),
|
|
156
|
+
("dwFlags", DWORD),
|
|
157
|
+
("pvExtraPolicyPara", c_void_p),
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
PCERT_CHAIN_POLICY_PARA = POINTER(CERT_CHAIN_POLICY_PARA)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class CERT_CHAIN_POLICY_STATUS(Structure):
|
|
165
|
+
_fields_ = (
|
|
166
|
+
("cbSize", DWORD),
|
|
167
|
+
("dwError", DWORD),
|
|
168
|
+
("lChainIndex", LONG),
|
|
169
|
+
("lElementIndex", LONG),
|
|
170
|
+
("pvExtraPolicyStatus", c_void_p),
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
PCERT_CHAIN_POLICY_STATUS = POINTER(CERT_CHAIN_POLICY_STATUS)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class CERT_CHAIN_ENGINE_CONFIG(Structure):
|
|
178
|
+
_fields_ = (
|
|
179
|
+
("cbSize", DWORD),
|
|
180
|
+
("hRestrictedRoot", HCERTSTORE),
|
|
181
|
+
("hRestrictedTrust", HCERTSTORE),
|
|
182
|
+
("hRestrictedOther", HCERTSTORE),
|
|
183
|
+
("cAdditionalStore", DWORD),
|
|
184
|
+
("rghAdditionalStore", c_void_p),
|
|
185
|
+
("dwFlags", DWORD),
|
|
186
|
+
("dwUrlRetrievalTimeout", DWORD),
|
|
187
|
+
("MaximumCachedCertificates", DWORD),
|
|
188
|
+
("CycleDetectionModulus", DWORD),
|
|
189
|
+
("hExclusiveRoot", HCERTSTORE),
|
|
190
|
+
("hExclusiveTrustedPeople", HCERTSTORE),
|
|
191
|
+
("dwExclusiveFlags", DWORD),
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
PCERT_CHAIN_ENGINE_CONFIG = POINTER(CERT_CHAIN_ENGINE_CONFIG)
|
|
196
|
+
PHCERTCHAINENGINE = POINTER(HCERTCHAINENGINE)
|
|
197
|
+
|
|
198
|
+
X509_ASN_ENCODING = 0x00000001
|
|
199
|
+
PKCS_7_ASN_ENCODING = 0x00010000
|
|
200
|
+
CERT_STORE_PROV_MEMORY = b"Memory"
|
|
201
|
+
CERT_STORE_ADD_USE_EXISTING = 2
|
|
202
|
+
USAGE_MATCH_TYPE_OR = 1
|
|
203
|
+
OID_PKIX_KP_SERVER_AUTH = c_char_p(b"1.3.6.1.5.5.7.3.1")
|
|
204
|
+
CERT_CHAIN_REVOCATION_CHECK_END_CERT = 0x10000000
|
|
205
|
+
CERT_CHAIN_REVOCATION_CHECK_CHAIN = 0x20000000
|
|
206
|
+
CERT_CHAIN_POLICY_IGNORE_ALL_NOT_TIME_VALID_FLAGS = 0x00000007
|
|
207
|
+
CERT_CHAIN_POLICY_IGNORE_INVALID_BASIC_CONSTRAINTS_FLAG = 0x00000008
|
|
208
|
+
CERT_CHAIN_POLICY_ALLOW_UNKNOWN_CA_FLAG = 0x00000010
|
|
209
|
+
CERT_CHAIN_POLICY_IGNORE_INVALID_NAME_FLAG = 0x00000040
|
|
210
|
+
CERT_CHAIN_POLICY_IGNORE_WRONG_USAGE_FLAG = 0x00000020
|
|
211
|
+
CERT_CHAIN_POLICY_IGNORE_INVALID_POLICY_FLAG = 0x00000080
|
|
212
|
+
CERT_CHAIN_POLICY_IGNORE_ALL_REV_UNKNOWN_FLAGS = 0x00000F00
|
|
213
|
+
CERT_CHAIN_POLICY_ALLOW_TESTROOT_FLAG = 0x00008000
|
|
214
|
+
CERT_CHAIN_POLICY_TRUST_TESTROOT_FLAG = 0x00004000
|
|
215
|
+
SECURITY_FLAG_IGNORE_CERT_CN_INVALID = 0x00001000
|
|
216
|
+
AUTHTYPE_SERVER = 2
|
|
217
|
+
CERT_CHAIN_POLICY_SSL = 4
|
|
218
|
+
FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000
|
|
219
|
+
FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200
|
|
220
|
+
|
|
221
|
+
# Flags to set for SSLContext.verify_mode=CERT_NONE
|
|
222
|
+
CERT_CHAIN_POLICY_VERIFY_MODE_NONE_FLAGS = (
|
|
223
|
+
CERT_CHAIN_POLICY_IGNORE_ALL_NOT_TIME_VALID_FLAGS
|
|
224
|
+
| CERT_CHAIN_POLICY_IGNORE_INVALID_BASIC_CONSTRAINTS_FLAG
|
|
225
|
+
| CERT_CHAIN_POLICY_ALLOW_UNKNOWN_CA_FLAG
|
|
226
|
+
| CERT_CHAIN_POLICY_IGNORE_INVALID_NAME_FLAG
|
|
227
|
+
| CERT_CHAIN_POLICY_IGNORE_WRONG_USAGE_FLAG
|
|
228
|
+
| CERT_CHAIN_POLICY_IGNORE_INVALID_POLICY_FLAG
|
|
229
|
+
| CERT_CHAIN_POLICY_IGNORE_ALL_REV_UNKNOWN_FLAGS
|
|
230
|
+
| CERT_CHAIN_POLICY_ALLOW_TESTROOT_FLAG
|
|
231
|
+
| CERT_CHAIN_POLICY_TRUST_TESTROOT_FLAG
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
wincrypt = WinDLL("crypt32.dll")
|
|
235
|
+
kernel32 = WinDLL("kernel32.dll")
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def _handle_win_error(result: bool, _: Any, args: Any) -> Any:
|
|
239
|
+
if not result:
|
|
240
|
+
# Note, actually raises OSError after calling GetLastError and FormatMessage
|
|
241
|
+
raise WinError()
|
|
242
|
+
return args
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
CertCreateCertificateChainEngine = wincrypt.CertCreateCertificateChainEngine
|
|
246
|
+
CertCreateCertificateChainEngine.argtypes = (
|
|
247
|
+
PCERT_CHAIN_ENGINE_CONFIG,
|
|
248
|
+
PHCERTCHAINENGINE,
|
|
249
|
+
)
|
|
250
|
+
CertCreateCertificateChainEngine.errcheck = _handle_win_error
|
|
251
|
+
|
|
252
|
+
CertOpenStore = wincrypt.CertOpenStore
|
|
253
|
+
CertOpenStore.argtypes = (LPCSTR, DWORD, HCRYPTPROV_LEGACY, DWORD, c_void_p)
|
|
254
|
+
CertOpenStore.restype = HCERTSTORE
|
|
255
|
+
CertOpenStore.errcheck = _handle_win_error
|
|
256
|
+
|
|
257
|
+
CertAddEncodedCertificateToStore = wincrypt.CertAddEncodedCertificateToStore
|
|
258
|
+
CertAddEncodedCertificateToStore.argtypes = (
|
|
259
|
+
HCERTSTORE,
|
|
260
|
+
DWORD,
|
|
261
|
+
c_char_p,
|
|
262
|
+
DWORD,
|
|
263
|
+
DWORD,
|
|
264
|
+
PCCERT_CONTEXT,
|
|
265
|
+
)
|
|
266
|
+
CertAddEncodedCertificateToStore.restype = BOOL
|
|
267
|
+
|
|
268
|
+
CertCreateCertificateContext = wincrypt.CertCreateCertificateContext
|
|
269
|
+
CertCreateCertificateContext.argtypes = (DWORD, c_char_p, DWORD)
|
|
270
|
+
CertCreateCertificateContext.restype = PCERT_CONTEXT
|
|
271
|
+
CertCreateCertificateContext.errcheck = _handle_win_error
|
|
272
|
+
|
|
273
|
+
CertGetCertificateChain = wincrypt.CertGetCertificateChain
|
|
274
|
+
CertGetCertificateChain.argtypes = (
|
|
275
|
+
HCERTCHAINENGINE,
|
|
276
|
+
PCERT_CONTEXT,
|
|
277
|
+
LPFILETIME,
|
|
278
|
+
HCERTSTORE,
|
|
279
|
+
PCERT_CHAIN_PARA,
|
|
280
|
+
DWORD,
|
|
281
|
+
c_void_p,
|
|
282
|
+
PCCERT_CHAIN_CONTEXT,
|
|
283
|
+
)
|
|
284
|
+
CertGetCertificateChain.restype = BOOL
|
|
285
|
+
CertGetCertificateChain.errcheck = _handle_win_error
|
|
286
|
+
|
|
287
|
+
CertVerifyCertificateChainPolicy = wincrypt.CertVerifyCertificateChainPolicy
|
|
288
|
+
CertVerifyCertificateChainPolicy.argtypes = (
|
|
289
|
+
c_ulong,
|
|
290
|
+
PCERT_CHAIN_CONTEXT,
|
|
291
|
+
PCERT_CHAIN_POLICY_PARA,
|
|
292
|
+
PCERT_CHAIN_POLICY_STATUS,
|
|
293
|
+
)
|
|
294
|
+
CertVerifyCertificateChainPolicy.restype = BOOL
|
|
295
|
+
|
|
296
|
+
CertCloseStore = wincrypt.CertCloseStore
|
|
297
|
+
CertCloseStore.argtypes = (HCERTSTORE, DWORD)
|
|
298
|
+
CertCloseStore.restype = BOOL
|
|
299
|
+
CertCloseStore.errcheck = _handle_win_error
|
|
300
|
+
|
|
301
|
+
CertFreeCertificateChain = wincrypt.CertFreeCertificateChain
|
|
302
|
+
CertFreeCertificateChain.argtypes = (PCERT_CHAIN_CONTEXT,)
|
|
303
|
+
|
|
304
|
+
CertFreeCertificateContext = wincrypt.CertFreeCertificateContext
|
|
305
|
+
CertFreeCertificateContext.argtypes = (PCERT_CONTEXT,)
|
|
306
|
+
|
|
307
|
+
CertFreeCertificateChainEngine = wincrypt.CertFreeCertificateChainEngine
|
|
308
|
+
CertFreeCertificateChainEngine.argtypes = (HCERTCHAINENGINE,)
|
|
309
|
+
|
|
310
|
+
FormatMessageW = kernel32.FormatMessageW
|
|
311
|
+
FormatMessageW.argtypes = (
|
|
312
|
+
DWORD,
|
|
313
|
+
LPCVOID,
|
|
314
|
+
DWORD,
|
|
315
|
+
DWORD,
|
|
316
|
+
LPWSTR,
|
|
317
|
+
DWORD,
|
|
318
|
+
c_void_p,
|
|
319
|
+
)
|
|
320
|
+
FormatMessageW.restype = DWORD
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def _verify_peercerts_impl(
|
|
324
|
+
ssl_context: ssl.SSLContext,
|
|
325
|
+
cert_chain: list[bytes],
|
|
326
|
+
server_hostname: str | None = None,
|
|
327
|
+
) -> None:
|
|
328
|
+
"""Verify the cert_chain from the server using Windows APIs."""
|
|
329
|
+
|
|
330
|
+
# If the peer didn't send any certificates then
|
|
331
|
+
# we can't do verification. Raise an error.
|
|
332
|
+
if not cert_chain:
|
|
333
|
+
raise ssl.SSLCertVerificationError("Peer sent no certificates to verify")
|
|
334
|
+
|
|
335
|
+
pCertContext = None
|
|
336
|
+
hIntermediateCertStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, None, 0, None)
|
|
337
|
+
try:
|
|
338
|
+
# Add intermediate certs to an in-memory cert store
|
|
339
|
+
for cert_bytes in cert_chain[1:]:
|
|
340
|
+
CertAddEncodedCertificateToStore(
|
|
341
|
+
hIntermediateCertStore,
|
|
342
|
+
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
|
|
343
|
+
cert_bytes,
|
|
344
|
+
len(cert_bytes),
|
|
345
|
+
CERT_STORE_ADD_USE_EXISTING,
|
|
346
|
+
None,
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
# Cert context for leaf cert
|
|
350
|
+
leaf_cert = cert_chain[0]
|
|
351
|
+
pCertContext = CertCreateCertificateContext(
|
|
352
|
+
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, leaf_cert, len(leaf_cert)
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
# Chain params to match certs for serverAuth extended usage
|
|
356
|
+
cert_enhkey_usage = CERT_ENHKEY_USAGE()
|
|
357
|
+
cert_enhkey_usage.cUsageIdentifier = 1
|
|
358
|
+
cert_enhkey_usage.rgpszUsageIdentifier = (c_char_p * 1)(OID_PKIX_KP_SERVER_AUTH)
|
|
359
|
+
cert_usage_match = CERT_USAGE_MATCH()
|
|
360
|
+
cert_usage_match.Usage = cert_enhkey_usage
|
|
361
|
+
chain_params = CERT_CHAIN_PARA()
|
|
362
|
+
chain_params.RequestedUsage = cert_usage_match
|
|
363
|
+
chain_params.cbSize = sizeof(chain_params)
|
|
364
|
+
pChainPara = pointer(chain_params)
|
|
365
|
+
|
|
366
|
+
if ssl_context.verify_flags & ssl.VERIFY_CRL_CHECK_CHAIN:
|
|
367
|
+
chain_flags = CERT_CHAIN_REVOCATION_CHECK_CHAIN
|
|
368
|
+
elif ssl_context.verify_flags & ssl.VERIFY_CRL_CHECK_LEAF:
|
|
369
|
+
chain_flags = CERT_CHAIN_REVOCATION_CHECK_END_CERT
|
|
370
|
+
else:
|
|
371
|
+
chain_flags = 0
|
|
372
|
+
|
|
373
|
+
try:
|
|
374
|
+
# First attempt to verify using the default Windows system trust roots
|
|
375
|
+
# (default chain engine).
|
|
376
|
+
_get_and_verify_cert_chain(
|
|
377
|
+
ssl_context,
|
|
378
|
+
None,
|
|
379
|
+
hIntermediateCertStore,
|
|
380
|
+
pCertContext,
|
|
381
|
+
pChainPara,
|
|
382
|
+
server_hostname,
|
|
383
|
+
chain_flags=chain_flags,
|
|
384
|
+
)
|
|
385
|
+
except ssl.SSLCertVerificationError as e:
|
|
386
|
+
# If that fails but custom CA certs have been added
|
|
387
|
+
# to the SSLContext using load_verify_locations,
|
|
388
|
+
# try verifying using a custom chain engine
|
|
389
|
+
# that trusts the custom CA certs.
|
|
390
|
+
custom_ca_certs: list[bytes] | None = ssl_context.get_ca_certs(
|
|
391
|
+
binary_form=True
|
|
392
|
+
)
|
|
393
|
+
if custom_ca_certs:
|
|
394
|
+
try:
|
|
395
|
+
_verify_using_custom_ca_certs(
|
|
396
|
+
ssl_context,
|
|
397
|
+
custom_ca_certs,
|
|
398
|
+
hIntermediateCertStore,
|
|
399
|
+
pCertContext,
|
|
400
|
+
pChainPara,
|
|
401
|
+
server_hostname,
|
|
402
|
+
chain_flags=chain_flags,
|
|
403
|
+
)
|
|
404
|
+
# Raise the original error, not the new error.
|
|
405
|
+
except ssl.SSLCertVerificationError:
|
|
406
|
+
raise e from None
|
|
407
|
+
else:
|
|
408
|
+
raise
|
|
409
|
+
finally:
|
|
410
|
+
CertCloseStore(hIntermediateCertStore, 0)
|
|
411
|
+
if pCertContext:
|
|
412
|
+
CertFreeCertificateContext(pCertContext)
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
def _get_and_verify_cert_chain(
|
|
416
|
+
ssl_context: ssl.SSLContext,
|
|
417
|
+
hChainEngine: HCERTCHAINENGINE | None,
|
|
418
|
+
hIntermediateCertStore: HCERTSTORE,
|
|
419
|
+
pPeerCertContext: c_void_p,
|
|
420
|
+
pChainPara: PCERT_CHAIN_PARA, # type: ignore[valid-type]
|
|
421
|
+
server_hostname: str | None,
|
|
422
|
+
chain_flags: int,
|
|
423
|
+
) -> None:
|
|
424
|
+
ppChainContext = None
|
|
425
|
+
try:
|
|
426
|
+
# Get cert chain
|
|
427
|
+
ppChainContext = pointer(PCERT_CHAIN_CONTEXT())
|
|
428
|
+
CertGetCertificateChain(
|
|
429
|
+
hChainEngine, # chain engine
|
|
430
|
+
pPeerCertContext, # leaf cert context
|
|
431
|
+
None, # current system time
|
|
432
|
+
hIntermediateCertStore, # additional in-memory cert store
|
|
433
|
+
pChainPara, # chain-building parameters
|
|
434
|
+
chain_flags,
|
|
435
|
+
None, # reserved
|
|
436
|
+
ppChainContext, # the resulting chain context
|
|
437
|
+
)
|
|
438
|
+
pChainContext = ppChainContext.contents
|
|
439
|
+
|
|
440
|
+
# Verify cert chain
|
|
441
|
+
ssl_extra_cert_chain_policy_para = SSL_EXTRA_CERT_CHAIN_POLICY_PARA()
|
|
442
|
+
ssl_extra_cert_chain_policy_para.cbSize = sizeof(
|
|
443
|
+
ssl_extra_cert_chain_policy_para
|
|
444
|
+
)
|
|
445
|
+
ssl_extra_cert_chain_policy_para.dwAuthType = AUTHTYPE_SERVER
|
|
446
|
+
ssl_extra_cert_chain_policy_para.fdwChecks = 0
|
|
447
|
+
if ssl_context.check_hostname is False:
|
|
448
|
+
ssl_extra_cert_chain_policy_para.fdwChecks = (
|
|
449
|
+
SECURITY_FLAG_IGNORE_CERT_CN_INVALID
|
|
450
|
+
)
|
|
451
|
+
if server_hostname:
|
|
452
|
+
ssl_extra_cert_chain_policy_para.pwszServerName = c_wchar_p(server_hostname)
|
|
453
|
+
|
|
454
|
+
chain_policy = CERT_CHAIN_POLICY_PARA()
|
|
455
|
+
chain_policy.pvExtraPolicyPara = cast(
|
|
456
|
+
pointer(ssl_extra_cert_chain_policy_para), c_void_p
|
|
457
|
+
)
|
|
458
|
+
if ssl_context.verify_mode == ssl.CERT_NONE:
|
|
459
|
+
chain_policy.dwFlags |= CERT_CHAIN_POLICY_VERIFY_MODE_NONE_FLAGS
|
|
460
|
+
chain_policy.cbSize = sizeof(chain_policy)
|
|
461
|
+
|
|
462
|
+
pPolicyPara = pointer(chain_policy)
|
|
463
|
+
policy_status = CERT_CHAIN_POLICY_STATUS()
|
|
464
|
+
policy_status.cbSize = sizeof(policy_status)
|
|
465
|
+
pPolicyStatus = pointer(policy_status)
|
|
466
|
+
CertVerifyCertificateChainPolicy(
|
|
467
|
+
CERT_CHAIN_POLICY_SSL,
|
|
468
|
+
pChainContext,
|
|
469
|
+
pPolicyPara,
|
|
470
|
+
pPolicyStatus,
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
# Check status
|
|
474
|
+
error_code = policy_status.dwError
|
|
475
|
+
if error_code:
|
|
476
|
+
# Try getting a human readable message for an error code.
|
|
477
|
+
error_message_buf = create_unicode_buffer(1024)
|
|
478
|
+
error_message_chars = FormatMessageW(
|
|
479
|
+
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
|
480
|
+
None,
|
|
481
|
+
error_code,
|
|
482
|
+
0,
|
|
483
|
+
error_message_buf,
|
|
484
|
+
sizeof(error_message_buf),
|
|
485
|
+
None,
|
|
486
|
+
)
|
|
487
|
+
|
|
488
|
+
# See if we received a message for the error,
|
|
489
|
+
# otherwise we use a generic error with the
|
|
490
|
+
# error code and hope that it's search-able.
|
|
491
|
+
if error_message_chars <= 0:
|
|
492
|
+
error_message = f"Certificate chain policy error {error_code:#x} [{policy_status.lElementIndex}]"
|
|
493
|
+
else:
|
|
494
|
+
error_message = error_message_buf.value.strip()
|
|
495
|
+
|
|
496
|
+
err = ssl.SSLCertVerificationError(error_message)
|
|
497
|
+
err.verify_message = error_message
|
|
498
|
+
err.verify_code = error_code
|
|
499
|
+
raise err from None
|
|
500
|
+
finally:
|
|
501
|
+
if ppChainContext:
|
|
502
|
+
CertFreeCertificateChain(ppChainContext.contents)
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
def _verify_using_custom_ca_certs(
|
|
506
|
+
ssl_context: ssl.SSLContext,
|
|
507
|
+
custom_ca_certs: list[bytes],
|
|
508
|
+
hIntermediateCertStore: HCERTSTORE,
|
|
509
|
+
pPeerCertContext: c_void_p,
|
|
510
|
+
pChainPara: PCERT_CHAIN_PARA, # type: ignore[valid-type]
|
|
511
|
+
server_hostname: str | None,
|
|
512
|
+
chain_flags: int,
|
|
513
|
+
) -> None:
|
|
514
|
+
hChainEngine = None
|
|
515
|
+
hRootCertStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, None, 0, None)
|
|
516
|
+
try:
|
|
517
|
+
# Add custom CA certs to an in-memory cert store
|
|
518
|
+
for cert_bytes in custom_ca_certs:
|
|
519
|
+
CertAddEncodedCertificateToStore(
|
|
520
|
+
hRootCertStore,
|
|
521
|
+
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
|
|
522
|
+
cert_bytes,
|
|
523
|
+
len(cert_bytes),
|
|
524
|
+
CERT_STORE_ADD_USE_EXISTING,
|
|
525
|
+
None,
|
|
526
|
+
)
|
|
527
|
+
|
|
528
|
+
# Create a custom cert chain engine which exclusively trusts
|
|
529
|
+
# certs from our hRootCertStore
|
|
530
|
+
cert_chain_engine_config = CERT_CHAIN_ENGINE_CONFIG()
|
|
531
|
+
cert_chain_engine_config.cbSize = sizeof(cert_chain_engine_config)
|
|
532
|
+
cert_chain_engine_config.hExclusiveRoot = hRootCertStore
|
|
533
|
+
pConfig = pointer(cert_chain_engine_config)
|
|
534
|
+
phChainEngine = pointer(HCERTCHAINENGINE())
|
|
535
|
+
CertCreateCertificateChainEngine(
|
|
536
|
+
pConfig,
|
|
537
|
+
phChainEngine,
|
|
538
|
+
)
|
|
539
|
+
hChainEngine = phChainEngine.contents
|
|
540
|
+
|
|
541
|
+
# Get and verify a cert chain using the custom chain engine
|
|
542
|
+
_get_and_verify_cert_chain(
|
|
543
|
+
ssl_context,
|
|
544
|
+
hChainEngine,
|
|
545
|
+
hIntermediateCertStore,
|
|
546
|
+
pPeerCertContext,
|
|
547
|
+
pChainPara,
|
|
548
|
+
server_hostname,
|
|
549
|
+
chain_flags,
|
|
550
|
+
)
|
|
551
|
+
finally:
|
|
552
|
+
if hChainEngine:
|
|
553
|
+
CertFreeCertificateChainEngine(hChainEngine)
|
|
554
|
+
CertCloseStore(hRootCertStore, 0)
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
@contextlib.contextmanager
|
|
558
|
+
def _configure_context(ctx: ssl.SSLContext) -> typing.Iterator[None]:
|
|
559
|
+
check_hostname = ctx.check_hostname
|
|
560
|
+
verify_mode = ctx.verify_mode
|
|
561
|
+
ctx.check_hostname = False
|
|
562
|
+
_set_ssl_context_verify_mode(ctx, ssl.CERT_NONE)
|
|
563
|
+
try:
|
|
564
|
+
yield
|
|
565
|
+
finally:
|
|
566
|
+
ctx.check_hostname = check_hostname
|
|
567
|
+
_set_ssl_context_verify_mode(ctx, verify_mode)
|
|
File without changes
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Python HTTP library with thread-safe connection pooling, file post support, user friendly, and more
|
|
3
|
+
"""
|
|
4
|
+
from __future__ import absolute_import
|
|
5
|
+
|
|
6
|
+
# Set default logging handler to avoid "No handler found" warnings.
|
|
7
|
+
import logging
|
|
8
|
+
import warnings
|
|
9
|
+
from logging import NullHandler
|
|
10
|
+
|
|
11
|
+
from . import exceptions
|
|
12
|
+
from ._version import __version__
|
|
13
|
+
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
|
|
14
|
+
from .filepost import encode_multipart_formdata
|
|
15
|
+
from .poolmanager import PoolManager, ProxyManager, proxy_from_url
|
|
16
|
+
from .response import HTTPResponse
|
|
17
|
+
from .util.request import make_headers
|
|
18
|
+
from .util.retry import Retry
|
|
19
|
+
from .util.timeout import Timeout
|
|
20
|
+
from .util.url import get_host
|
|
21
|
+
|
|
22
|
+
# === NOTE TO REPACKAGERS AND VENDORS ===
|
|
23
|
+
# Please delete this block, this logic is only
|
|
24
|
+
# for urllib3 being distributed via PyPI.
|
|
25
|
+
# See: https://github.com/urllib3/urllib3/issues/2680
|
|
26
|
+
try:
|
|
27
|
+
import urllib3_secure_extra # type: ignore # noqa: F401
|
|
28
|
+
except ImportError:
|
|
29
|
+
pass
|
|
30
|
+
else:
|
|
31
|
+
warnings.warn(
|
|
32
|
+
"'urllib3[secure]' extra is deprecated and will be removed "
|
|
33
|
+
"in a future release of urllib3 2.x. Read more in this issue: "
|
|
34
|
+
"https://github.com/urllib3/urllib3/issues/2680",
|
|
35
|
+
category=DeprecationWarning,
|
|
36
|
+
stacklevel=2,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
__author__ = "Andrey Petrov (andrey.petrov@shazow.net)"
|
|
40
|
+
__license__ = "MIT"
|
|
41
|
+
__version__ = __version__
|
|
42
|
+
|
|
43
|
+
__all__ = (
|
|
44
|
+
"HTTPConnectionPool",
|
|
45
|
+
"HTTPSConnectionPool",
|
|
46
|
+
"PoolManager",
|
|
47
|
+
"ProxyManager",
|
|
48
|
+
"HTTPResponse",
|
|
49
|
+
"Retry",
|
|
50
|
+
"Timeout",
|
|
51
|
+
"add_stderr_logger",
|
|
52
|
+
"connection_from_url",
|
|
53
|
+
"disable_warnings",
|
|
54
|
+
"encode_multipart_formdata",
|
|
55
|
+
"get_host",
|
|
56
|
+
"make_headers",
|
|
57
|
+
"proxy_from_url",
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
logging.getLogger(__name__).addHandler(NullHandler())
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def add_stderr_logger(level=logging.DEBUG):
|
|
64
|
+
"""
|
|
65
|
+
Helper for quickly adding a StreamHandler to the logger. Useful for
|
|
66
|
+
debugging.
|
|
67
|
+
|
|
68
|
+
Returns the handler after adding it.
|
|
69
|
+
"""
|
|
70
|
+
# This method needs to be in this __init__.py to get the __name__ correct
|
|
71
|
+
# even if urllib3 is vendored within another package.
|
|
72
|
+
logger = logging.getLogger(__name__)
|
|
73
|
+
handler = logging.StreamHandler()
|
|
74
|
+
handler.setFormatter(logging.Formatter("%(asctime)s %(levelname)s %(message)s"))
|
|
75
|
+
logger.addHandler(handler)
|
|
76
|
+
logger.setLevel(level)
|
|
77
|
+
logger.debug("Added a stderr logging handler to logger: %s", __name__)
|
|
78
|
+
return handler
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# ... Clean up.
|
|
82
|
+
del NullHandler
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# All warning filters *must* be appended unless you're really certain that they
|
|
86
|
+
# shouldn't be: otherwise, it's very hard for users to use most Python
|
|
87
|
+
# mechanisms to silence them.
|
|
88
|
+
# SecurityWarning's always go off by default.
|
|
89
|
+
warnings.simplefilter("always", exceptions.SecurityWarning, append=True)
|
|
90
|
+
# SubjectAltNameWarning's should go off once per host
|
|
91
|
+
warnings.simplefilter("default", exceptions.SubjectAltNameWarning, append=True)
|
|
92
|
+
# InsecurePlatformWarning's don't vary between requests, so we keep it default.
|
|
93
|
+
warnings.simplefilter("default", exceptions.InsecurePlatformWarning, append=True)
|
|
94
|
+
# SNIMissingWarnings should go off only once.
|
|
95
|
+
warnings.simplefilter("default", exceptions.SNIMissingWarning, append=True)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def disable_warnings(category=exceptions.HTTPWarning):
|
|
99
|
+
"""
|
|
100
|
+
Helper for quickly disabling all urllib3 warnings.
|
|
101
|
+
"""
|
|
102
|
+
warnings.simplefilter("ignore", category)
|