Skip to main content

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, and page.

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 Client and asynchronous AsyncClient classes with simple query(...) methods.
  • Returns a list of Proxy dataclasses (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 like http, https, socks5.
  • page: pagination page index (integer).

Errors and exceptions

  • APIError is raised for non-2xx HTTP responses. The message attempts to surface the API error field when present, otherwise it falls back to the response body.
  • InvalidAPIKey is a subclass used when the API returns HTTP 401.
  • NetworkError and TimeoutError wrap 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

freeproxy_python-1.0.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

freeproxy_python-1.0.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

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

Hashes for freeproxy_python-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1e7544b941e6760f8fb4c200d05e4a57555b2f03ae6a253916857b36b35af521
MD5 c58a4cf838b26737539746bf950002ac
BLAKE2b-256 ed63667fd828d628a340c1814dbcae6fd1e02be44af6ced6e6e0b5ea167d3292

See more details on using hashes here.

File details

Details for the file freeproxy_python-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for freeproxy_python-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 be38568884adf20b078dbf632d07307bcf72d6a6ff99d3510dc6c28dde506c92
MD5 c944c7159c78479aaa558cfbc48d543f
BLAKE2b-256 278c750928ef89e76673cfe4a5d724287b25036d76421ed04679371bf616aa81

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page