{"id":26505654,"url":"https://github.com/datamart/cgi-proxy","last_synced_at":"2025-10-27T22:35:10.916Z","repository":{"id":62561577,"uuid":"143088192","full_name":"Datamart/CGI-Proxy","owner":"Datamart","description":"🌐 Python Simple CGI HTTP Proxy.","archived":false,"fork":false,"pushed_at":"2024-01-15T17:14:26.000Z","size":87,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-14T12:06:16.862Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.org/project/cgiproxy/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Datamart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["Datamart"],"custom":["https://www.paypal.me/vpodk","https://amzn.to/3mpgAJh"]}},"created_at":"2018-08-01T01:30:18.000Z","updated_at":"2024-05-18T16:42:21.000Z","dependencies_parsed_at":"2024-01-15T18:58:16.729Z","dependency_job_id":"1bddaa68-0684-4957-b11b-f92b99b21f63","html_url":"https://github.com/Datamart/CGI-Proxy","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Datamart%2FCGI-Proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Datamart%2FCGI-Proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Datamart%2FCGI-Proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Datamart%2FCGI-Proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Datamart","download_url":"https://codeload.github.com/Datamart/CGI-Proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244695633,"owners_count":20494848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-20T21:57:59.909Z","updated_at":"2025-10-27T22:35:05.898Z","avatar_url":"https://github.com/Datamart.png","language":"Python","funding_links":["https://github.com/sponsors/Datamart","https://www.paypal.me/vpodk","https://amzn.to/3mpgAJh"],"categories":[],"sub_categories":[],"readme":"# CGI Proxy\n[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)\n[![PyPI Version](https://img.shields.io/pypi/v/cgiproxy.svg)](https://pypi.org/project/cgiproxy/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/cgiproxy.svg)](https://pypi.org/project/cgiproxy/)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/cgiproxy.svg?style=flat)](https://pypi.org/project/cgiproxy/)\n[![PyPI Format](https://img.shields.io/pypi/format/cgiproxy.svg?style=flat)](https://pypi.org/project/cgiproxy/)\n[![PyPI Status](https://img.shields.io/pypi/status/cgiproxy.svg?style=flat)](https://pypi.org/project/cgiproxy/)\n\nSimple CGI HTTP Proxy.\n* Sets the `X-Forwarded-For` header with the client IP address;\n* Sets the `User-Agent` header with the client' `User-Agent` string;\n* Decodes `gzip`-ed content;\n* Prints all errors to `stderr`;\n* Uses `urllib2` for Python 2 and `urllib.request` for Python 3.\n\n## Installation\n\nInstall from PyPI using `pip`:\n\n```bash\n$ pip install cgiproxy\n```\n\n\n## Methods\n\n### do_get(url, headers=None)\nPerforms `GET` request.\n\n**Arguments:**\n* `url` - The request URL as `str`.\n* `headers` - Optional HTTP request headers as `dict`.\n\n**Returns:**\n* A tuple of `(content, status_code, response_headers)`\n\n\n### do_head(url, headers=None)\nPerforms `HEAD` request.\n\n**Arguments:**\n* `url` - The request URL as `str`.\n* `headers` - Optional HTTP request headers as `dict`.\n\n**Returns:**\n* A tuple of `(content='', status_code, response_headers)`\n\n\n### do_post(url, data=None, headers=None)\nPerforms `POST` request. Converts query to `POST` params if `data` is `None`.\n\n**Arguments:**\n* `url` - The request URL as `str`.\n* `data` - Optional HTTP POST data as URL-encoded `str`.\n* `headers` - Optional HTTP request headers as `dict`.\n\n**Returns:**\n* A tuple of `(content, status_code, response_headers)`\n\n\n### get_http_status(url, headers=None)\nGets HTTP status code.\n\n**Arguments:**\n* `url` - The request URL as `str`.\n* `headers` - Optional HTTP request headers as `dict`.\n\n**Returns:**\n* An HTTP status code.\n\n\n### get_response_headers(url, headers=None)\nGets HTTP response headers.\n\n**Arguments:**\n* `url` - The request URL as `str`.\n* `headers` - Optional HTTP request headers as `dict`.\n\n**Returns:**\n* An HTTP response headers as `dict`.\n\n\n## Examples\n\n```python\nimport cgiproxy\n\nstatus = cgiproxy.get_http_status('https://www.pageportrait.com/')\nprint(200 == status)\n\nheaders = cgiproxy.get_response_headers('https://komito.net/')\nprint(headers.get('content-type'))\n\ncontent, status, headers = cgiproxy.do_head('https://www.dtm.io/')\nprint('' == content)\nprint(200 == status)\nprint(headers.get('content-type'))\n\ncontent, status, headers = cgiproxy.do_get('https://www.dtm.io/', headers={\n    'User-Agent': 'Mozilla/5.0 (compatible; Darwin/18.2.0) cgiproxy/18.12',\n    'X-Custom-Header': 'value'\n})\nprint('' != content)\nprint(200 == status)\nprint(headers.get('content-type'))\n\ncontent, status, headers = cgiproxy.do_post('https://example.com/', data='aaa%3Dbbb%26ccc%3Dddd')\nprint('' != content)\nprint(200 == status)\nprint(headers.get('content-type'))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatamart%2Fcgi-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatamart%2Fcgi-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatamart%2Fcgi-proxy/lists"}