https://github.com/bachorp/no-proxy
`no_proxy`/`NO_PROXY` parser and evaluator.
https://github.com/bachorp/no-proxy
Last synced: about 1 year ago
JSON representation
`no_proxy`/`NO_PROXY` parser and evaluator.
- Host: GitHub
- URL: https://github.com/bachorp/no-proxy
- Owner: bachorp
- License: mit
- Created: 2025-06-08T10:40:17.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-09T14:41:52.000Z (about 1 year ago)
- Last Synced: 2025-06-09T14:49:53.955Z (about 1 year ago)
- Language: Python
- Homepage: https://pypi.org/project/no-proxy/
- Size: 1.95 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/bachorp/no-proxy/actions/workflows/test.yaml)
[](https://pypi.org/project/no-proxy/)
# `no-proxy`
Standalone `no_proxy`/`NO_PROXY` parser and evaluator.
## Usage
```python
from no_proxy import bypass # More specific functions and types available
from urllib.parse import urlparse
bypass(no_proxy="*", host="example.com") # True
bypass("127.0.0.0/8,::1", "127.0.0.1") # True
my_host = urlparse("//example.com:5000/path?x=y").hostname # example.com
bypass("www.example.com,example.org", my_host) # False
```
## Specification
A *no-proxy string* is either `*` or a comma-separated list of *no-proxy entries*.
An IP-address or hostname matches a no-proxy string if the string is `*` or if any of its entries matches.
A no-proxy entry is either
- an IP-address, which matches itself,
- an IP-range, which matches included IP-addresses,
- a domain with leading `.`, which matches all of its subdomains, or
- a hostname, which matches itself.
Hostnames are not validated and there is no special handling of whitespace, trailing dots, ports, etc.