{"id":13598482,"url":"https://github.com/simonw/asgi-proxy-lib","last_synced_at":"2025-04-19T17:50:30.302Z","repository":{"id":177736181,"uuid":"660835887","full_name":"simonw/asgi-proxy-lib","owner":"simonw","description":"An ASGI function for proxying to a backend over HTTP","archived":false,"fork":false,"pushed_at":"2023-07-01T02:03:56.000Z","size":11,"stargazers_count":21,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-18T07:53:34.661Z","etag":null,"topics":["asgi","httpx"],"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/simonw.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}},"created_at":"2023-07-01T01:34:51.000Z","updated_at":"2024-10-10T09:19:22.000Z","dependencies_parsed_at":"2023-07-19T00:00:24.147Z","dependency_job_id":null,"html_url":"https://github.com/simonw/asgi-proxy-lib","commit_stats":null,"previous_names":["simonw/asgi-proxy-lib","simonw/asgi-proxy"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fasgi-proxy-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fasgi-proxy-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fasgi-proxy-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fasgi-proxy-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonw","download_url":"https://codeload.github.com/simonw/asgi-proxy-lib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249753002,"owners_count":21320645,"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":["asgi","httpx"],"created_at":"2024-08-01T17:00:53.002Z","updated_at":"2025-04-19T17:50:30.295Z","avatar_url":"https://github.com/simonw.png","language":"Python","readme":"# asgi-proxy-lib\n\n[![PyPI](https://img.shields.io/pypi/v/asgi-proxy-lib.svg)](https://pypi.org/project/asgi-proxy-lib/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/asgi-proxy-lib?include_prereleases\u0026label=changelog)](https://github.com/simonw/asgi-proxy-lib/releases)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/asgi-proxy-lib/blob/main/LICENSE)\n\nAn ASGI function for proxying to a backend over HTTP\n\n**⚠️ Warning: this is an early alpha.**\n\n## Installation\n\nInstall this library using `pip`:\n\n    pip install asgi-proxy-lib\n\n## Usage\n\nThis library provides a single ASGI function called `asgi_proxy`. You can use it like this:\n\n```python\nfrom asgi_proxy import asgi_proxy\n\napp = asgi_proxy(\"https://datasette.io\")\n```\nNow `app` is an ASGI application that will proxy all incoming HTTP requests to the equivalent URL on `https://datasette.io`.\n\nThe function takes an optional second argument, `log=` - set this to a Python logger, or any object that has `.info(msg)` and `.error(msg)` methods, and the proxy will log information about each request it proxies.\n\nIt also takes a `timeout=` option, which defaults to `None` for no timeout. This can be set to a floating point value in seconds to enforce a timeout on requests that are being proxied.\n\n## CLI tool\n\nYou can try this module out like so:\n\n```bash\npython -m asgi_proxy https://datasette.io\n```\nYou may need to `pip install uvicorn` first for this to work.\n\nAlternatively, use [uv](https://github.com/astral-sh/uv) like this:\n```bash\nuv run --with uvicorn --with asgi-proxy-lib python -m asgi_proxy https://datasette.io\n```\n\nThis will start a server on port 8000 that proxies to `https://datasette.io`.\n\nAdd `-p PORT` to specify a different port, `--timeout 3` to set a timeout, `--verbose` to see debug logging, and `--host 127.0.0.1` to listen on a different host (the default is `0.0.0.0`).\n\n## Development\n\nTo contribute to this library, first checkout the code. Then create a new virtual environment:\n\n    cd asgi-proxy-lib\n    python -m venv venv\n    source venv/bin/activate\n\nNow install the dependencies and test dependencies:\n\n    pip install -e '.[test]'\n\nTo run the tests:\n\n    pytest\n","funding_links":[],"categories":["Proxies"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fasgi-proxy-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonw%2Fasgi-proxy-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fasgi-proxy-lib/lists"}