Python client for the FreeProxy API
Project description
GetFreeProxy — Python client
This is a small, typed Python client for the GetFreeProxy API (https://developer.getfreeproxy.com).
About the API
The GetFreeProxy API exposes a simple endpoint to fetch public proxy servers:
- GET /v1/proxies — returns a JSON array of proxy objects. Optional query parameters include
country,protocol, andpage.
Each proxy object contains fields such as ip, port, protocol, proxyUrl, countryCode, anonymity, uptime, and timestamps like lastAliveAt.
Key behaviours of this client
- Minimal runtime dependency (
httpx). - Synchronous
Clientand asynchronousAsyncClientclasses with simplequery(...)methods. - Returns a list of
Proxydataclasses (fields mapped to Pythonic names, e.g.country_code). - Raises typed exceptions on errors:
APIError,InvalidAPIKey,NetworkError,TimeoutError,ParseError.
Installation
Install from PyPI (when published) or locally in editable mode during development:
pip install freeproxy-python
# or local editable install for development:
pip install -e .[dev]
Quick examples
Sync example:
from freeproxy import Client
client = Client(api_key="YOUR_API_KEY")
proxies = client.query(country="US", protocol="https")
for p in proxies:
print(p.to_url())
client.close()
Async example:
import asyncio
from freeproxy import AsyncClient
async def main():
client = AsyncClient(api_key="YOUR_API_KEY")
proxies = await client.query(country="US")
for p in proxies:
print(p.to_url())
await client.aclose()
asyncio.run(main())
Authentication
Provide your API key to the client constructor. The client sends Authorization: Bearer <API_KEY> in requests.
Query parameters
country: ISO 3166-1 alpha-2 country code (e.g.US).protocol: proxy protocol filter likehttp,https,socks5.page: pagination page index (integer).
Errors and exceptions
APIErroris raised for non-2xx HTTP responses. The message attempts to surface the APIerrorfield when present, otherwise it falls back to the response body.InvalidAPIKeyis a subclass used when the API returns HTTP 401.NetworkErrorandTimeoutErrorwrap transport-level failures.
Notes and limitations
- This client intentionally keeps runtime dependencies minimal and does not implement automatic retries. It also does not stream responses — responses are small (up to ~10 proxies per request).
Testing
Run the test suite locally with:
pip install -e .[dev]
pytest -q
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file freeproxy_python-1.0.1.tar.gz.
File metadata
- Download URL: freeproxy_python-1.0.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e7544b941e6760f8fb4c200d05e4a57555b2f03ae6a253916857b36b35af521
|
|
| MD5 |
c58a4cf838b26737539746bf950002ac
|
|
| BLAKE2b-256 |
ed63667fd828d628a340c1814dbcae6fd1e02be44af6ced6e6e0b5ea167d3292
|
File details
Details for the file freeproxy_python-1.0.1-py3-none-any.whl.
File metadata
- Download URL: freeproxy_python-1.0.1-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be38568884adf20b078dbf632d07307bcf72d6a6ff99d3510dc6c28dde506c92
|
|
| MD5 |
c944c7159c78479aaa558cfbc48d543f
|
|
| BLAKE2b-256 |
278c750928ef89e76673cfe4a5d724287b25036d76421ed04679371bf616aa81
|