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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: proxypool_util-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 de8d121f63c9e6505bdd977884b6deaa5b29f44c2f1de040f44e8c7212c3f7f4
MD5 0c69228121ed62aa472ad73762adbe0f
BLAKE2b-256 600396338b36c5a2bedabaf46bdf1a408bac0f8ee89d638a9ccd4d92346dc779

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for proxypool_util-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a31f2f6a75c7d580be801d26503c122cafe01c3ecd041530580a7485f0a4de4f
MD5 6bcabce3774904b83dbb15b4eafd6ee0
BLAKE2b-256 b220200026ac4675c49f0e8817a528fab3d617678c7d01a2fbbd680d42204c49

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