Relax python default SSL Context verification flags
Project description
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)urllib3requestsaiohttp
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file context_relaxer-0.1.3.tar.gz.
File metadata
- Download URL: context_relaxer-0.1.3.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
504fb75fe5c979409ca66fdde1ae708f72fbb620126d04086a5c4bad1d863d47
|
|
| MD5 |
ae6905fda9f23a1ac048d5baa01a0a51
|
|
| BLAKE2b-256 |
ddb5d752157a3e1ca80313f85b93707de0606ae9f47b7bcceff9f8be7d6a2e6c
|
File details
Details for the file context_relaxer-0.1.3-py3-none-any.whl.
File metadata
- Download URL: context_relaxer-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fa4c46e860d9bea1905f7c0eb2ea38820181625ca8ecfe039d768f3877790c1
|
|
| MD5 |
e15717b7f84c940ac19b23cf5a7aa1b4
|
|
| BLAKE2b-256 |
3442336805873dc2e7bbb4b8c422ed438edfe1e67ee72e3b9befa5e08765e59c
|