Skip to main content

Proxy pool to rotate and manage proxies

Project description

ProxyPool v0.1.0

by Myhailo Razbeiko

Instalation

Install using pip

pip install proxypool_util

Usage

Create a ProxyPool object

MyPool = ProxyPool(["https://proxy1:port", "https://proxy2:port", "https://proxy3:port"])

Attributes:

  • proxy_list -- a list of proxies
  • max_give_outs -- maximum number of simultaneous uses of one proxy
  • max_time_outs -- maximum number of time-outs one proxy can receive, being banned after exceeding it
  • max_uses -- maximum number of uses per proxy
  • time_out_on_use -- time-out given to proxy after being used

Methods:

  • available_proxy_count() -- returns number of available proxies
  • Proxy() -- returns ProxyPool.Proxy() linked to this ProxyPool

Generate proxy object

MyProxy = MyPool.Proxy()

Get an available proxy to use

temp_proxy = MyProxy.use()
  • If no proxies are available ProxyExceptions.NoValidProxies will be raised. This can happen due to all proxies being banned.
  • If no proxies are available, but at least one is on a time-out ProxyExceptions.ProxiesTimeout will be raised. You can access a time-out end timestamp with ProxyExceptions.ProxiesTimeout().timeout.

Timeout last proxy

MyProxy.timeout(25)  # proxy will be returned to proxy pool and not available for 25 seconds 

Ban last proxy

MyProxy.ban()  # proxy will be banned and returned to proxy pool

Example

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

proxypool_util-0.1.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

proxypool_util-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file proxypool_util-0.1.1.tar.gz.

File metadata

  • Download URL: proxypool_util-0.1.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.2

File hashes

Hashes for proxypool_util-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f0a362023efad02de27c59c74ab6ab7a426222057182b91651067553baad50a9
MD5 6298a92ab3982837b488e2fd9752e72e
BLAKE2b-256 fd9cab8b8b59b30fac1b09dd315c166f521196843f0189b6a68724e3b72f670d

See more details on using hashes here.

File details

Details for the file proxypool_util-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for proxypool_util-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 525dd8b1bfc4f1366017e49a2b7cc0e28e99e89c634e8417581e648ddbae50c0
MD5 9d5714349b218c85ea3b92e59c0747fe
BLAKE2b-256 1fe7dabfebc49f774c81c330e3fd73849d8a9108ebb2f5bc9c200e5ae07f516b

See more details on using hashes here.

Supported by

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