HTTP/WebSocket asgi proxy.
Reason this release was yanked:
https://github.com/WSH032/fastapi-proxy-lib/security/advisories/GHSA-7vwr-g6pm-9hc8
Project description
FastAPI Proxy Lib
HTTP/WebSocket proxy for starlette/FastAPI
CI/CD | |
Code | |
Package | |
Meta |
Documentation: https://wsh032.github.io/fastapi-proxy-lib/
Source Code: https://github.com/WSH032/fastapi-proxy-lib/
Features
- Out of the box ! Helper functions to get FastAPI
app
/router
for proxy conveniently. - Only
Starlette
is required for it to work (FastAPI
is optional). - Support both HTTP and WebSocket proxy.
- Supports all HTTP methods (
GET
,POST
, etc.)
- Supports all HTTP methods (
- Support both reverse proxy and forward proxy.
- Transparently and losslessly handle all proxy requests,
- Asynchronous streaming transfer, support file proxy.
other features
- Strict linting and strict-mode Pyright type checking.
- 100% Type Completeness, Code coverage of over 95%.
- Forced keep-alive connections, minimizing proxy latency.
- Handle errors as gracefully as possible.
FastAPI Proxy Lib
stands on the shoulders of giants
So, it perfectly supports all features of httpx.AsyncClient, you can even use your custom AsyncClient
, Transport
.
Installation
!!! note
We follow semantic versioning.<br> This is a young project, and before 1.0.0, there may be changes in the API (though we try to avoid that).<br> We recommend pinning to any minor versions, such as 0.1.x.
Pypi will come soon, please install from github temporarily:
pip install fastapi-proxy-lib[standard]@git+https://github.com/WSH032/fastapi-proxy-lib.git
Perhaps you've noticed that we're installing fastapi-proxy-lib[standard]
instead of fastapi-proxy-lib
. The difference is:
- The former will install
FastAPI
at the same time. - The latter installs only the basic dependencies for
fastapi-proxy-lib
.
If you only need to use this library with Starlette, you only need to install the latter.
Quick start
With the helper functions, get the FastAPI proxy server app is very convenient and out of the box:
from fastapi_proxy_lib.fastapi.app import reverse_http_app
app = reverse_http_app(base_url="http://www.example.com/foo/")
That's all! Now, you can launch the proxy server with uvicorn
:
uvicorn main:app --host 127.0.0.1 --port 8000
Then, visit http://127.0.0.1:8000/bar?baz=1
, you will get the response from http://www.example.com/foo/bar?baz=1
.
For support with FastAPI router
or only using Starlette
, please visit to our documentation 📚 for more details.
development
- If you find any issues, please don't hesitate to open an issue.
- If you need assistance, feel free to start a discussion.
- Welcome PR
English is not the native language of the author (me), so if you find any areas for improvement in the documentation, your feedback is welcome.
If you think this project helpful, consider giving it a star , which makes me happy. :smile:
License
This project is licensed under the terms of the Apache License 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fastapi_proxy_lib-0.0.1b0.tar.gz
.
File metadata
- Download URL: fastapi_proxy_lib-0.0.1b0.tar.gz
- Upload date:
- Size: 53.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa06869a55065677308abfcc7f099329b96def807be7ff32006da2a3cebf5153 |
|
MD5 | 9c3e7ce582404dfb2340d1666577dedd |
|
BLAKE2b-256 | 77899f49f344046781f50b982e4a796554defe5aa3b4f76496dfafe4d2344e0c |
Provenance
File details
Details for the file fastapi_proxy_lib-0.0.1b0-py3-none-any.whl
.
File metadata
- Download URL: fastapi_proxy_lib-0.0.1b0-py3-none-any.whl
- Upload date:
- Size: 39.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3aa8e59b4f7c69e5e03888c59c244b536f21a13510a8e5734d7129791c1414f6 |
|
MD5 | 3711c5f9dff1d04530d6cc4aee4c3bea |
|
BLAKE2b-256 | 5f641874c475534490721b6043f911cc7b12fe173ae18d05b2d0e616eea07733 |