{"id":21895886,"url":"https://github.com/seahoh/extproxy","last_synced_at":"2025-07-12T20:12:44.747Z","repository":{"id":57427782,"uuid":"227629421","full_name":"SeaHOH/extproxy","owner":"SeaHOH","description":"ExtProxy extend urllib2's ProxyHandler to support extra proxy types: HTTPS, SOCKS. It provides a consistent user experience like HTTP proxy for the users.","archived":false,"fork":false,"pushed_at":"2023-08-23T07:59:38.000Z","size":35,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-16T17:59:15.186Z","etag":null,"topics":["https","proxyhandler","socks","urllib"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SeaHOH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-12T14:46:52.000Z","updated_at":"2024-01-21T00:09:03.000Z","dependencies_parsed_at":"2024-11-28T13:52:10.722Z","dependency_job_id":null,"html_url":"https://github.com/SeaHOH/extproxy","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"9d9be5639eff58b360adbb6ba1b5144748508f06"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/SeaHOH/extproxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeaHOH%2Fextproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeaHOH%2Fextproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeaHOH%2Fextproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeaHOH%2Fextproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SeaHOH","download_url":"https://codeload.github.com/SeaHOH/extproxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SeaHOH%2Fextproxy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265047848,"owners_count":23703218,"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":["https","proxyhandler","socks","urllib"],"created_at":"2024-11-28T13:41:04.584Z","updated_at":"2025-07-12T20:12:44.729Z","avatar_url":"https://github.com/SeaHOH.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExtProxy\n[![license](https://img.shields.io/github/license/SeaHOH/extproxy)](https://github.com/SeaHOH/extproxy/blob/master/LICENSE)\n[![release status](https://img.shields.io/github/v/release/SeaHOH/extproxy?include_prereleases\u0026sort=semver)](https://github.com/SeaHOH/extproxy/releases)\n[![code size](https://img.shields.io/github/languages/code-size/SeaHOH/extproxy)](https://github.com/SeaHOH/extproxy)\n\nExtProxy extend urllib2's ProxyHandler to support extra proxy types: HTTPS, SOCKS. It provides a consistent user experience like HTTP proxy for the users.\n\nThis script is using a non-side-effects monkey patch, it did not applied to build-in module socket, just inject some codes into `Request`, `ProxyHandler`, `HTTPConnection`, `SSLContext` method's processing. Don't need to worry about the patching, you can using everything like before, or you can unpatch it at any time.\n\n# Installation\nInstall from \n[![version](https://img.shields.io/pypi/v/ExtProxy)](https://pypi.org/project/ExtProxy/)\n[![package format](https://img.shields.io/pypi/format/ExtProxy)](https://pypi.org/project/ExtProxy/#files)\n[![monthly downloads](https://img.shields.io/pypi/dm/ExtProxy)](https://pypi.org/project/ExtProxy/#files)\n\n    pip install ExtProxy\n\nOr download and Install from source code\n\n    python setup.py install\n\n# Compatibility \n- Python \u003e= 2.7\n- Require PySocks to support SOCKS proxy type\n\n# Usage\n```py\n# Target can be imported before monkey patching\nfrom urllib.request import urlopen, build_opener, ProxyHandler\n\n\n# Import extproxy, auto apply monkey patching by `extproxy.patch_items`\nimport extproxy\n\n\n# Use origin HTTP proxy\nproxy = \"http://127.0.0.1:8080\"\n\n\n# Use HTTPS proxy, use `set_https_proxy` to custom proxy's SSL verify mode\nimport ssl\nproxy = \"https://127.0.0.1:8443\"\n\ncafile = \"cafile path\"\nset_https_proxy(proxy, check_hostname=False, cafile=cafile)\n\ncontext_settings = {\n    \"protocol\": ssl.PROTOCOL_TLSv1_2,\n    \"cert_reqs\": ssl.CERT_REQUIRED,  #\n    \"check_hostname\": True,          #\n    \"cafile\": \"cafile path\",         #\n    \"capath\": \"cafiles dir path\",    #\n    \"cadata\": b\"ca data\"             # Uesd to server auth\n    \"certfile\": \"certfile path\",  #\n    \"keyfile\": \"keyfile path\",    # Uesd to client auth\n}\ncontext = ssl._create_unverified_context(**context_settings)\n ...  # More custom settings\nset_https_proxy(proxy, context=context)\n\n\n# Use SOCKS proxy, `socks` can be: socks, socks4, socks4a, socks5, socks5h\n# SOCKS4 does not support remote resolving, but SOCKS4a/5 supported\n# 'socks' means SOCKS5, 'socks5h' means do not use remote resolving\nproxy = \"socks://127.0.0.1:1080\"\n\n\n# Set proxy via system/python environment variables\nimport os\nos.environ[\"HTTP_PROXY\"] = proxy\nos.environ[\"HTTPS_PROXY\"] = proxy\nprint(urlopen(\"https://httpbin.org/ip\").read().decode())\n\n\n# Set proxy via ProxyHandler\nopener = build_opener(ProxyHandler({\n    \"http\": proxy,\n    \"https\": proxy\n}))\nprint(opener.open(\"https://httpbin.org/ip\").read().decode())\n\n\n# Restore monkey patch, then HTTPS, SOCKS proxy use can not continue working\nextproxy.restore_items()\n```\n\n# License\nExtProxy is released under the [MIT License](https://github.com/SeaHOH/extproxy/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseahoh%2Fextproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseahoh%2Fextproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseahoh%2Fextproxy/lists"}