CGI Proxy
Simple CGI HTTP Proxy.
- Sets the
X-Forwarded-Forheader with the client IP address; - Sets the
User-Agentheader with the client'User-Agentstring; - Decodes
gzip-ed content; - Prints all errors to
stderr; - Uses
urllib2for Python 2 andurllib.requestfor Python 3.
Installation
Install from PyPI using pip:
$ pip install cgiproxy
Methods
do_get(url, headers=None)
Performs GET request.
Arguments:
url- The request URL asstr.headers- Optional HTTP request headers asdict.
Returns:
- A tuple of
(content, status_code, response_headers)
do_head(url, headers=None)
Performs HEAD request.
Arguments:
url- The request URL asstr.headers- Optional HTTP request headers asdict.
Returns:
- A tuple of
(content='', status_code, response_headers)
do_post(url, data=None, headers=None)
Performs POST request. Converts query to POST params if data is None.
Arguments:
url- The request URL asstr.data- Optional HTTP POST data as URL-encodedstr.headers- Optional HTTP request headers asdict.
Returns:
- A tuple of
(content, status_code, response_headers)
get_http_status(url, headers=None)
Gets HTTP status code.
Arguments:
url- The request URL asstr.headers- Optional HTTP request headers asdict.
Returns:
- An HTTP status code.
get_response_headers(url, headers=None)
Gets HTTP response headers.
Arguments:
url- The request URL asstr.headers- Optional HTTP request headers asdict.
Returns:
- An HTTP response headers as
dict.
Examples
import cgiproxy
status = cgiproxy.get_http_status('https://www.pageportrait.com/')
print(200 == status)
headers = cgiproxy.get_response_headers('https://komito.net/')
print(headers.get('content-type'))
content, status, headers = cgiproxy.do_head('https://www.dtm.io/')
print('' == content)
print(200 == status)
print(headers.get('content-type'))
content, status, headers = cgiproxy.do_get('https://www.dtm.io/', headers={
'User-Agent': 'Mozilla/5.0 (compatible; Darwin/18.2.0) cgiproxy/18.12',
'X-Custom-Header': 'value'
})
print('' != content)
print(200 == status)
print(headers.get('content-type'))
content, status, headers = cgiproxy.do_post('https://example.com/', data='aaa%3Dbbb%26ccc%3Dddd')
print('' != content)
print(200 == status)
print(headers.get('content-type'))
Metadata
Release files for cgiproxy 20.11.14
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 |
|---|---|---|---|---|
| cgiproxy-20.11.14.tar.gz | 5.1 kB | Without provenance | Details for cgiproxy-20.11.14.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cgiproxy-20.11.14-py3-none-any.whl | Python 3 | none | any | Details for cgiproxy-20.11.14-py3-none-any.whl |
| cgiproxy-20.11.14-py2-none-any.whl | Python 2 | none | any | Details for cgiproxy-20.11.14-py2-none-any.whl |
Total release size: 23.5 kB
Release files / cgiproxy-20.11.14.tar.gz
| Download URL | cgiproxy-20.11.14.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b52f0a5238b33f1a3dad094d39dd769e5d7ae82aaa3f7ff532f2bad19d16af22
|
|
BLAKE2b-256 checksum How to use checksums |
425fbe48e373d196afb8fa53459bf4de8c1a7986b80f753120e16f386aa839d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
|
Release files / cgiproxy-20.11.14-py3-none-any.whl
| Download URL | cgiproxy-20.11.14-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2c70e5e921d2a7367c0743aed1d5b45e12df6f8a1b23b111983230fecb993798
|
|
BLAKE2b-256 checksum How to use checksums |
9f9c67e0ded3c6b7f6e46a0a14411a1b886e34588e2b044fc5fb62e59e2519b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
|
Release files / cgiproxy-20.11.14-py2-none-any.whl
| Download URL | cgiproxy-20.11.14-py2-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
822b8363db7918ffb9b4c53e314d023b5a095377f0c0097067695a27c7ec7392
|
|
BLAKE2b-256 checksum How to use checksums |
df91a7124563fa8f37436f6ab7c364376193a477b98b2c52fe2830d7b37b3cef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/2.7.18
|
Security for cgiproxy 20.11.14
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.