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.4.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

proxypool_util-0.1.4-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: proxypool_util-0.1.4.tar.gz
  • Upload date:
  • Size: 5.2 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.4.tar.gz
Algorithm Hash digest
SHA256 b9d1ac905a652b16999d6ad282bb458189399e009a626f6f346002b3abc7c127
MD5 95b5ac0e95f59724578121ddc943f4af
BLAKE2b-256 d9c4e762b1b1825ce5623869d721567f537ed4f5f3f691ba5789d28878d62c25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for proxypool_util-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e2a4581a57b8ff4fef574dd0e0842f3534287d80d114f8611657b172bedede9d
MD5 7f45447aee0262fef0cc1925f33c348e
BLAKE2b-256 35db9e9bb94ea89345d4fb80946ad57789930a19b5899e3b7e6fa8ae2864082b

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