This FastAPI application provides a proxy service using curl-cffi
, allowing users to send HTTP requests (GET, POST, DELETE, PUT) with support for parameters, headers, cookies, proxies, and browser impersonation.
- Supports multiple HTTP methods: GET, POST, DELETE, and PUT.
- cURL impersonation: Mimic different browsers using
curl-cffi
'simpersonate
option. - Supports proxies: Route requests through specified proxies.
- Handles JSON and text responses: Automatically detects and parses JSON responses.
- Python 3.8+
- FastAPI
- curl-cffi
- Uvicorn
- Gunicorn (for running the server)
pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8001 --reload
Endpoint:
POST /
Request Body:
{
"method": "GET",
"url": "https://example.com",
"params": { "key": "value" },
"headers": { "User-Agent": "MyApp" },
"cookies": { "session": "abcd1234" },
"data": { "field": "value" },
"impersonate": "chrome",
"proxies": { "http": "http://proxy.example.com:8081" },
"return_data": true
}
Example Request:
curl -X POST "http://127.0.0.1:8001/" \
-H "Content-Type: application/json" \
-d '{"method": "GET", "url": "https://example.com"}'
Response Format:
{
"status_code": 200,
"headers": { "Content-Type": "application/json" },
"data": { "key": "value" },
"cookies": { "session": "abcd1234" }
}
You can build your own Docker image using the provided DOckerfile:
docker build -t fastapi-curl-proxy .
docker run -p 8001:8001 fastapi-curl-proxy
Alternatively, you can pull the existing image from the repository:
docker pull yenoluna/fastapi-curl-proxy
This project is licensed under the MIT License.