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

Uploaded Source

Built Distribution

proxypool_util-0.1.3-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: proxypool_util-0.1.3.tar.gz
  • Upload date:
  • Size: 4.6 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.3.tar.gz
Algorithm Hash digest
SHA256 074632031c66599f3dc3c4b945810d1d98343b1672906ead0d2e4e9a9fda6c58
MD5 e86f7b487f2fe7a89f2e88fb9e9412ae
BLAKE2b-256 f06af2e4a109823768eb75dadca31c06566651416a49c01083f363a5267ebdaf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for proxypool_util-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 83fb7991322e5f611e81ad323bacadf5af1d86dc8b3e170cda181004203aca81
MD5 95993820cd7d6c9586e7513829953575
BLAKE2b-256 c9016f6756a1e405cbd62e9f32e3257e3f86c416b1be776acb7d21c40ebd5537

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