Skip to main content

ProxyMan 🌐

A simple Proxy manager for Python

Created with ❤️ by @MeshMonitors

Features

✨ Proxy Management:

  • Load proxies from a file
  • Support for IP-based and username-password authentication

🔄 Proxy Refresh:

  • Automatically refresh the proxy list from a remote source
  • Filter proxies based on location (US, UK, FR, or all)

🔀 Random Proxy:

  • Retrieve a random proxy from the loaded list

Installation

ProxyMan can be installed using pip:

pip install ProxyMan

Usage

Loading proxies from a file

from ProxyMan import ProxyMan, AuthType
import os

# Load proxies from a file
current_dir = os.path.dirname(os.path.realpath(__file__))
current_dir = os.path.dirname(current_dir)

pm = ProxyMan(file_path=current_dir + "/proxies.txt", auth=AuthType.IP)

Configuring ProxyMan

from ProxyMan import ProxyMan, Filter, AuthType

# Create a ProxyMan instance
webshare_api_key: str = "" # Optional (required to use the refresh feature)
scrape_filter: Filter = Filter.ALL # Optional (default: Filter.ALL) Filter proxies based on location
fail_count: int = 3 # Optional (default: 3) Remove a proxy from the list after it fails this many times
proxies_to_scrape: int = 3000 # Optional (default: 3000)
auth_type: AuthType = AuthType.IP # Optional (default: AuthType.IP) The type of authentication to use (IP or USER_PASS)

pm = ProxyMan(api_key=webshare_api_key, auth=auth_type, scrape_filter=scrape_filter, fail_count=fail_count, proxies_to_scrape=proxies_to_scrape)

# Get a random proxy
proxy: dict = pm.random()

print(proxy) # { "http": "http://0.0.0.0:8080"", "https": "http://0.0.0.0:8080" }

Failing a proxy

# If proxy fails somewhere in your code, call the fail method
# It will be removed from the list after it fails 3 times (or whatever you set fail_count to)

pm.increment_bad_proxies(proxy['http'])

Refreshing the proxy list

# Refresh the proxy list from the remote source
# This will overwrite the current list and update proxies.txt with the new list
await pm.update_proxies()

Getting a random proxy

# Get a random proxy from the list
proxy: dict = pm.random()

# Make a request 
requests.get("https://example.com", proxies=proxy)

Metadata

Release files for ProxyMan 0.0.8

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

Source distribution (sdist)

Source distribution for ProxyMan 0.0.8
File Size Uploaded Provenance Actions
ProxyMan-0.0.8.tar.gz 4.8 kB Without provenance Details for ProxyMan-0.0.8.tar.gz

Release files / ProxyMan-0.0.8.tar.gz

Download URL ProxyMan-0.0.8.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a41876c36e1599e0c2305ae6cdc978f7e9be5387a67097068476e5aaaeef4a0f
BLAKE2b-256 checksum
How to use checksums
2b0bc9ff3714b84c726b024accfda4c6ae07f857b51fccac693035ce8a729766
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.1

Security for ProxyMan 0.0.8

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