filter-certwarning
Decorators for filtering InsecureRequestWarnings in requests and other urllib3-based Python 3 modules
NOTE: tested only for Python3.
When developing applications/modules using the requests module (or using urllib3 directly), it is sometimes useful to disable certificate validation, or to permit consumers/users to do so. However, doing so makes each request issue an InsecureRequestWarning, which is a lot of noise.
filter-certwarning provides two decorators to make this behavior more reasonable.
@filter_certwarning.warnonce causes the warning to be issued only warnonce, the first time the decorated function is called
@filter_certwarning.silent is an alias for @filter_certwarning('ignore'), and causes the warning to be entirely suppressed for that function call
- Examples:
A requests-based app with verification off that issues the warning only warnonce:
import requests import filter_certwarning ... @filter_certwarning.warnonce sub get_data(): # the next line will fire an InsecureRequestWarning the first time this # function is called, but subsequent calls to this function will be silent resp = requests.get('https://localhost/status', verify=False)The following supresses the warning entirely. This is not recommended unless you’ve given a lot of thought to the security implications and trade-offs.:
import requests import filter_certwarning ... @filter_certwarning.silent sub get_data(): # the next line will fire an InsecureRequestWarning the first time this # function is called, but subsequent calls to this function will be silent resp = requests.get('https://localhost/status', verify=False)
Installing
To install:
pip install filter-certwarning
Metadata
Release files for filter-certwarning 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| filter-certwarning-1.0.1.tar.gz | 5.2 kB | Without provenance | Details for filter-certwarning-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| filter_certwarning-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for filter_certwarning-1.0.1-py3-none-any.whl |
Total release size: 9.6 kB
Release files / filter-certwarning-1.0.1.tar.gz
| Download URL | filter-certwarning-1.0.1.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6e6721a92fefb0391f6cdbdd50185c0e004ab9c0393e894f4a4cf031a0284f7
|
|
BLAKE2b-256 checksum How to use checksums |
9f0f26881f28c8d65ab1b5ccccdc447b2e6bd2713e722a9b344db41bc0a66e32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Release files / filter_certwarning-1.0.1-py3-none-any.whl
| Download URL | filter_certwarning-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6bc9d807e545d7c739b5dfac9b8e85d6abf9fc9f87898cd9b19a395f317cf8d1
|
|
BLAKE2b-256 checksum How to use checksums |
5729da6887f0ad5151c4e0129581d40aa5898037faf674ba5bc736c813080006
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Security for filter-certwarning 1.0.1
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.