Skip to main content

Pubproxpy

An easy to use Python wrapper for pubproxy's public proxy API.

Installation

Install the pybproxpy package using your standard Python package manager e.g.

$ pip install pubproxpy

Keyless API Limitations

API Daily Limits

At the time of writing this, without an API key the pubproxy API limits users to 5 proxies per request and 50 requests per day. The maximum proxies per request is always used to minimize rate limiting along with getting the most proxies possible within the request limit.

API Rate Limiting

Without an API key pubproxy limits users to one request per second so a ProxyFetcher will try to ensure that at most only one request per second is done without an API key. This is synchronized between ProxyFetchers, but this is not thread safe so make sure all ProxyFetchers are on the same thread if you have no API key. The rate limiting is quite severe, upon being hit the API seems to deny requests for several minutes/hours.

Quickstart Example

from pubproxpy import ProxyFetcher

# ProxyFetcher for proxies that support https, are elite anonymity level,
# and connected in 15 seconds or less
http_pf = ProxyFetcher(protocol="http", https=True, level="elite",
                       time_to_connect=15)

# ProxyFetcher for proxies that use the socks5 protocol, are located in
# the US or Canada and support POST requests
socks_pf = ProxyFetcher(protocol="socks5", countries=["US", "CA"], post=True)

# Get and print 10 of each kind of proxy, even though there are multiple
# `ProxyFetcher`s, the delays will be coordinated to prevent rate limiting
for _ in range(10):
    https_proxy = http_pf.get_proxy()
    socks_proxy = socks_pf.get_proxy()

    # Do something with the proxies, like spawn worker threads that use them

Advanced Example

from pubproxpy import ProxyFetcher

# Get a single elite proxy from France
pf = ProxyFetcher(level="elite", countries="FR")
elite_proxy = pf.get_proxy()

# Now get 20 elite proxies from anywhere except France and Ireland that support
# post requests
# NOTE: setting `not_countries` will remove `countries` since they're
#       incompatible
pf.update_params(post=True, not_countries=["FR", "IE"])
anon_proxies = pf.get_proxies(20)

Documentation

Getting proxies is fully handled by the ProxyFetcher class. There are several parameters you can pass on initialization, by using set_params, or by using update_params to narrow down the proxies to a suitable range. From there you can just call get_proxy to receive a proxy in the form of {ip-address}:{port-number} or call get_proxies(amount) to receive a list of amount proxies. Also there is an internal blacklist to ensure that the same proxy ip and port combo will not be used more than once per ProxyFetcher.

ProxyFetcher Parameters

Parameter Type Description
api_key int API key for a paid account, you can also set $PUBPROXY_API_KEY to pass your key, passing the api_key parameter will override this
level str [Options: anonymous, elite] Proxy anonymity level
protocol str [Options: http, socks4, socks5] The proxy protocol
countries str or list<str> locations of the proxy using the ISO-3166 alpha-2 country code, Incompatible with not_countries
not_countries str or list<str> blacklist locations of the proxy using the ISO-3166 alpha-2 country code, Incompatible with countries
last_checked int [Bounds: 1-1000] Minutes since the proxy was checked
port int Proxies using a specific port
time_to_connect int [Bounds: 1-60] How many seconds it took for the proxy to connect
cookies bool Supports requests with cookies
google bool Can connect to Google
https bool Supports https requests
post bool Supports post requests
referer bool Supports referer requests
user_agent bool Supports user-agent requests

Metadata

Release files for pubproxpy 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pubproxpy 0.1.9
File Size Uploaded Provenance Actions
pubproxpy-0.1.9.tar.gz 17.8 kB Without provenance Details for pubproxpy-0.1.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pubproxpy 0.1.9
File Interpreter ABI Platform Actions
pubproxpy-0.1.9-py3-none-any.whl Python 3 none any Details for pubproxpy-0.1.9-py3-none-any.whl

Total release size: 65.4 kB

Release files / pubproxpy-0.1.9.tar.gz

Download URL pubproxpy-0.1.9.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
63ba5978431c62c152bbce801a90655c3430ee9da253a4fcfaeb9b0839825cf4
BLAKE2b-256 checksum
How to use checksums
2523ff0de1b9f25525518d3d6c136956cae56a1caf2ff298f66eecce352f867c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.11 CPython/3.7.3 Linux/5.1.8-arch1-1-ARCH

Release files / pubproxpy-0.1.9-py3-none-any.whl

Download URL pubproxpy-0.1.9-py3-none-any.whl
Size 47.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3abcb6c506617d222b59e287674bc62caed5a331c531b264ee284555c805ff39
BLAKE2b-256 checksum
How to use checksums
addcc079874c4fda1cf6bff073c4b119159b36e3b9723b0844ebe100a89b08ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.11 CPython/3.7.3 Linux/5.1.8-arch1-1-ARCH

Security for pubproxpy 0.1.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page