Skip to main content

SSL Context Relaxer

Relax the SSL verification strictness introduced in python 3.13

Monkey-patching structure inspired by truststore

Usage

Install the library

pip install context-relaxer

At the entry point of your project, inject the monkey-patch

import context_relaxer

context_relaxer.inject_into_ssl()

Rationale

Many corporates have systems that proxy internal traffic, and sometimes they produce broken certificates.

Yes, they should be fixed, No, probably won't be fixed soon, but that doesn't mean you should pass verify=False or ssl_verify=False to every HTTPS session instance.

Usage with truststore

You can use this concurrently with truststore, as we monkey-patch different properties of ssl, this library patches the default context creation function and truststore patches the SSLContext class.

Usage example (the order doesn't matter)

import context_relaxer
import truststore

truststore.inject_into_ssl()
context_relaxer.inject_into_ssl()

Tested usage

  • urllib (builtin)
  • urllib3
  • requests
  • aiohttp

Requests 2.32.0 - 2.32.4

In version 2.32.0 requests introduced a preloaded context, which was reverted in 2.32.5

If you are using a version in this range, make sure to inject the monkey-patch before importing requests

Metadata

Release files for context-relaxer 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for context-relaxer 0.1.4
File Size Uploaded Provenance
context_relaxer-0.1.4.tar.gz 4.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for context-relaxer 0.1.4
File Interpreter ABI Platform
context_relaxer-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 kB

Release files / context_relaxer-0.1.4.tar.gz

Download URL context_relaxer-0.1.4.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e29fd278acb6d97874552c21c0952f93899327d6fef37c4f8627dfe661455f4f
BLAKE2b-256 checksum
How to use checksums
d7361f18f8720734a27f7d973370dbb276b46c6d2be5e3efbc0bbd5312c9e3d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.22.2","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / context_relaxer-0.1.4-py3-none-any.whl

Download URL context_relaxer-0.1.4-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20f31240b85a4cbae9dbf1169359471d91c1f66e33c17a49a0a9a780b5f6014d
BLAKE2b-256 checksum
How to use checksums
29ed93aa3d74131fbfefb3c6b3c40d05c84d7fe22419f506bce00f40b7cbeed7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.22.2","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for context-relaxer 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page