Skip to main content

A simple and quick way to get a proxy.

Project description

EasyProxies

PyPI version Downloads Python versions License

A simple and fast library to interact with proxyscan.io and proxyscan-like APIs to fetch free proxy servers.


Features

  • Custom Host Support: Easily override BASE_URL to point to any custom or mirror proxyscan-like API.
  • Flexible Formatting: Support for both JSON (ProxyDescriptor objects) and TXT (ip:port strings) output formats.
  • Custom Headers: Ships with configurable default HTTP headers (including a standard User-Agent).
  • Dynamic Generator: Infinite proxy iterator with on-the-fly parameter updating.

Installation

Install via pip:

pip install EasyProxies

Install via Poetry:

poetry add EasyProxies

Quick Start

Basic Usage & Custom Host Setup

If you need to route requests to a custom proxyscan-like backend, simply override Proxies.BASE_URL:

from easy_proxies import Proxies, const

# Override base URL if needed
Proxies.BASE_URL = "https://your-custom-proxy-api.com"

# Fetch 20 proxies in text format (ip:port)
proxies = Proxies.get(limit=20, format='txt')
print(proxies)

Integration with requests

By default (format='json'), Proxies.get() and Proxies.best() return ProxyDescriptor objects with helpful conversion properties:

import requests
from easy_proxies import Proxies

# Get the best proxy available
best_proxy = Proxies.best()

# Convert directly to a requests-compatible dictionary
proxies_dict = best_proxy.as_requests_proxy
print(f"Using proxy: {proxies_dict}")

try:
  response = requests.get("https://httpbin.org/ip", proxies=proxies_dict, timeout=10)
  print(response.json())
except requests.RequestException as e:
  print(f"Connection failed: {e}")

CLI

EasyProxies --help
usage: EasyProxies [-h] [-f {json,txt}] [-l LIMIT] [--best] [-t {http,https,socks4,socks5} [{http,https,socks4,socks5} ...]]
                   [-a {transparent,anonymous,elite} [{transparent,anonymous,elite} ...]] [-c COUNTRY [COUNTRY ...]] [--not-country NOT_COUNTRY [NOT_COUNTRY ...]]
                   [--ping PING] [--uptime UPTIME]

Fetch proxy servers from proxyscan API via easy_proxies CLI.

optional arguments:
  -h, --help            show this help message and exit
  -f {json,txt}, --format {json,txt}
                        Output format: json (list of proxy objects) or txt (ip:port list). Default: json
  -l LIMIT, --limit LIMIT
                        Number of proxies to list (1-20). Default: 10
  --best                Fetch only the single best (fastest and most reliable) proxy.
  -t {http,https,socks4,socks5} [{http,https,socks4,socks5} ...], --type {http,https,socks4,socks5} [{http,https,socks4,socks5} ...]
                        Filter by proxy protocol(s).
  -a {transparent,anonymous,elite} [{transparent,anonymous,elite} ...], --level {transparent,anonymous,elite} [{transparent,anonymous,elite} ...]
                        Filter by anonymity level(s).
  -c COUNTRY [COUNTRY ...], --country COUNTRY [COUNTRY ...]
                        Filter by 2-letter country code(s), e.g., US FR.
  --not-country NOT_COUNTRY [NOT_COUNTRY ...]
                        Exclude 2-letter country code(s), e.g., CN NL.
  --ping PING           Maximum ping response time in ms.
  --uptime UPTIME       Minimum proxy uptime percentage (1-100).
  

API Documentation

Module Exports

from easy_proxies import Proxies, ProxyDescriptor, DEFAULT_HEADERS, const
  • Proxies: Main interface class for making API requests.
  • ProxyDescriptor: Data class model wrapping proxy details.
  • DEFAULT_HEADERS: Default headers dictionary used for HTTP requests (e.g., {'User-Agent': 'Mozilla/5.0'}).
  • const: Constants for filtering parameters (Format, Level, Type, Limit, etc.).

Class Proxies

An interface to communicate with the proxy provider.

Attributes:

  • BASE_URL: str — Base target URL (defaults to 'https://www.proxyscan.io'). Can be modified globally at runtime.

Methods:

  • get(**kwargs) -> list[ProxyDescriptor | str] | str Fetches a list of proxies matching the specified filters.
  • raw_request(param: dict[str, str | int]) -> list[ProxyDescriptor | str] | str Accepts a dictionary of raw query parameters instead of keyword arguments.
  • already_list(type_: str) -> list[str] Returns a pre-assembled list of ip:port lines for a given protocol ('http', 'socks5', etc.).
  • best(**kwargs) -> ProxyDescriptor | str Returns the fastest and most reliable proxy server based on the query criteria.
  • eternal_generator(**kwargs) -> Generator An infinite generator yielding proxies sequentially. Yields None when no proxies match. Parameters can be updated dynamically via .send(new_params).

Filtering Parameters (kwargs for get / best)

Parameter Type / Allowed Values Description
format 'json', 'txt' Output format (JSON returns ProxyDescriptor objects).
level 'transparent', 'anonymous', 'elite' Anonymity level.
type 'http', 'https', 'socks4', 'socks5' Proxy protocols (supports single str or list/iterable).
limit 120 Max number of proxies to return.
uptime 1100 Minimum reliability/uptime percentage.
country str or list[str] (e.g., 'US', 'FR') Filter by country code(s).
not_country str or list[str] (e.g., 'CN', 'NL') Exclude specific country code(s).
port int Filter by a specific port number.
ping int Max response time (ping) in milliseconds.
last_check int Max seconds since the last proxy check.

Structure of ProxyDescriptor

Represents detailed information about a single proxy server.

Key Attributes:

  • Ip: str — IP address.
  • Port: str — Port number.
  • Host: str — Formatted as ip:port.
  • Ping: int — Response latency in milliseconds.
  • Uptime: float — Connection success rate ratio.
  • Anonymity: str — Anonymity level.
  • Type: list[str] — Supported protocols.
  • Location: Location — Object containing geolocation data (city, country, countryCode, isp, etc.).

Properties & Features:

  • as_requests_proxy: Returns {'http': '...', 'https': '...'} dictionary for requests/httpx.
  • Rich comparisons: Supports native sorting (<, >, ==) based on availability, ping, uptime, and anonymity.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

easyproxies-3.0.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

easyproxies-3.0.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file easyproxies-3.0.1.tar.gz.

File metadata

  • Download URL: easyproxies-3.0.1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.13.14 Linux/7.1.3-zen2

File hashes

Hashes for easyproxies-3.0.1.tar.gz
Algorithm Hash digest
SHA256 337c840646a7ca5bb49b6dfdbecb7ecc572649b932dd8cf6281138d029f292dc
MD5 fde3d847a8bda837e9b6cf2d4c9d314b
BLAKE2b-256 a73f62d4a77cae84cb5e7ea14d6c7020f934d6811cefe6ad3af64c155e0760ed

See more details on using hashes here.

File details

Details for the file easyproxies-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: easyproxies-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.13.14 Linux/7.1.3-zen2

File hashes

Hashes for easyproxies-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 09a564503d16814e7bd98235e373d40259f22f2686da6b5778714d4cd6af36ba
MD5 d26fdac93a17c5c407320c31dabda6b6
BLAKE2b-256 e9c31d38bf1a6a31bc003421d7eefaaef1975aff306d484c027869248c3c4edb

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