Skip to main content

Lightweight Python client for the Proxy11 free proxy API

Project description

proxy11

PyPI Python License: MIT

Official Python client for the Proxy11 proxy API.

Use it to fetch fresh proxy lists, filter by country or anonymity type, rotate through proxies, and export simple ip:port files.

Install

pip install proxy11

Quick Start

from proxy11 import ProxyClient

client = ProxyClient(api_key="YOUR_API_KEY")

proxies = client.get(limit=50, country="us")
proxy = client.random(proxy_type="anonymous")
proxy_list = client.as_list(limit=100)

Examples

Get Proxies

proxies = client.get(limit=50, country="us", proxy_type="anonymous", speed=1.0)

Get ip:port List

proxies = client.as_list(limit=50)
# ["103.152.112.166:8080", "45.77.56.114:4145"]

Random Proxy

proxy = client.random(country="us")
proxy_details = client.random_proxy()

Save to File

count = client.save("proxies.txt", country="us")
print(f"saved {count} proxies")

Rotator

rotator = client.rotator(country="us", proxy_type="anonymous", auto_refresh=True, refresh_after=50)

for _ in range(100):
    proxy = rotator.next()
    print(proxy)
    # if proxy fails:
    # rotator.mark_dead(proxy)

Auto-Rotating Requests Session

session = client.session(country="us", proxy_type="anonymous")

resp = session.get("https://httpbin.org/ip", timeout=15)
print(resp.json())

Error Handling

from proxy11 import APIError, NoProxiesError, ProxyClient

client = ProxyClient("YOUR_API_KEY")

try:
    proxy = client.random(country="us")
except NoProxiesError:
    print("No proxies matched the filters")
except APIError as exc:
    print(f"Proxy11 API error: {exc}")

API

Method Description
get(**filters) Return proxy rows as dictionaries
as_list(**filters) Return proxies as ip:port strings
random(**filters) Return one random ip:port proxy
random_proxy(**filters) Return one random proxy dictionary
save(path, **filters) Save ip:port proxies to a file
rotator(**filters) Create a proxy rotator
session(**filters) Create a requests.Session with rotating proxies

Filters

Parameter Type Description
limit int Max proxies to return, capped by your plan
country string Country name or two-letter country code
port int Proxy port
speed float Max response time in seconds
proxy_type string anonymous or transparent

Links

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

proxy11-1.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

proxy11-1.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file proxy11-1.1.0.tar.gz.

File metadata

  • Download URL: proxy11-1.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for proxy11-1.1.0.tar.gz
Algorithm Hash digest
SHA256 fad385158461d326570c5ed91f6a6153e512d7e525ceae15dc0f62809e97a717
MD5 6baab2049736600d5312a61535a70cb8
BLAKE2b-256 467347acfbdacd47c7dc7e137741f07a73b3b97324481bbb6958a111315a521c

See more details on using hashes here.

File details

Details for the file proxy11-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: proxy11-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for proxy11-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a82369debdc85b128019ca54d470f019ffccd1bb4d8335132cf45695306c618
MD5 dda1881b92c64b3babe5b5603b1ee33a
BLAKE2b-256 d59178f962ecbc0eeb913c75adf6cc2b0839ab647175318c1c1af03df2904b0d

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