{"id":21215307,"url":"https://github.com/romis2012/httpx-socks","last_synced_at":"2025-04-08T13:06:53.878Z","repository":{"id":41557928,"uuid":"278350166","full_name":"romis2012/httpx-socks","owner":"romis2012","description":"Proxy (HTTP, SOCKS) transports for httpx","archived":false,"fork":false,"pushed_at":"2024-12-10T06:08:19.000Z","size":1401,"stargazers_count":81,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T11:06:13.191Z","etag":null,"topics":["asyncio","http","httpx","proxy","python","socks4","socks5","trio"],"latest_commit_sha":null,"homepage":"","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/romis2012.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2020-07-09T11:49:15.000Z","updated_at":"2025-03-30T04:37:33.000Z","dependencies_parsed_at":"2024-04-22T09:31:57.024Z","dependency_job_id":"ebbfaeca-cbe3-48d2-9909-1ba81c5964cf","html_url":"https://github.com/romis2012/httpx-socks","commit_stats":{"total_commits":74,"total_committers":2,"mean_commits":37.0,"dds":"0.013513513513513487","last_synced_commit":"271b5f2d11b12ab16841a7402536a1f6e0c41af2"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romis2012%2Fhttpx-socks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romis2012%2Fhttpx-socks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romis2012%2Fhttpx-socks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romis2012%2Fhttpx-socks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romis2012","download_url":"https://codeload.github.com/romis2012/httpx-socks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247847610,"owners_count":21006100,"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":["asyncio","http","httpx","proxy","python","socks4","socks5","trio"],"created_at":"2024-11-20T21:36:45.729Z","updated_at":"2025-04-08T13:06:53.853Z","avatar_url":"https://github.com/romis2012.png","language":"Python","readme":"# httpx-socks\n\n[![CI](https://github.com/romis2012/httpx-socks/actions/workflows/ci.yml/badge.svg)](https://github.com/romis2012/httpx-socks/actions/workflows/ci.yml)\n[![Coverage Status](https://codecov.io/gh/romis2012/httpx-socks/branch/master/graph/badge.svg)](https://codecov.io/gh/romis2012/httpx-socks)\n[![PyPI version](https://badge.fury.io/py/httpx-socks.svg)](https://pypi.python.org/pypi/httpx-socks)\n\u003c!--\n[![Downloads](https://pepy.tech/badge/httpx-socks/month)](https://pepy.tech/project/httpx-socks)\n--\u003e\n\nThe `httpx-socks` package provides proxy transports for [httpx](https://github.com/encode/httpx) client. \nSOCKS4(a), SOCKS5(h), HTTP (tunneling) proxy supported.\nIt uses [python-socks](https://github.com/romis2012/python-socks) for core proxy functionality.\n\n\n## Requirements\n- Python \u003e= 3.6\n- httpx\u003e=0.21.0\n- python-socks\u003e=2.0.0\n- async-timeout\u003e=3.0.1 (optional)\n- trio\u003e=0.16.0 (optional)\n\n\n## Installation\n\nonly sync proxy support:\n```\npip install httpx-socks\n```\n\nto include optional asyncio support (it requires async-timeout):\n```\npip install httpx-socks[asyncio]\n```\n\nto include optional trio support:\n```\npip install httpx-socks[trio]\n```\n\n\n## Usage\n\n#### sync transport\n```python\nimport httpx\nfrom httpx_socks import SyncProxyTransport\n\ndef fetch(url):\n    transport = SyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080')\n    with httpx.Client(transport=transport) as client:\n        res = client.get(url)\n        return res.text\n```\n\n#### async transport (asyncio, trio)\n```python\nimport httpx\nfrom httpx_socks import AsyncProxyTransport\n\nasync def fetch(url):\n    transport = AsyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080')\n    async with httpx.AsyncClient(transport=transport) as client:\n        res = await client.get(url)\n        return res.text\n```\n\n#### secure proxy connections (aka \"HTTPS proxies\", experimental feature, both sync and async support)\n```python\nimport ssl\nimport httpx\nfrom httpx_socks import AsyncProxyTransport\n\nasync def fetch(url):\n    proxy_ssl = ssl.SSLContext(ssl.PROTOCOL_TLS)\n    proxy_ssl.verify_mode = ssl.CERT_REQUIRED\n    proxy_ssl.load_verify_locations(...)\n    \n    transport = AsyncProxyTransport.from_url('http://user:password@127.0.0.1:8080', proxy_ssl=proxy_ssl)\n    async with httpx.AsyncClient(transport=transport) as client:\n        res = await client.get(url)\n        return res.text\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromis2012%2Fhttpx-socks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromis2012%2Fhttpx-socks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromis2012%2Fhttpx-socks/lists"}