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.2.tar.gz
(4.5 kB
view details)
Built Distribution
File details
Details for the file proxypool_util-0.1.2.tar.gz
.
File metadata
- Download URL: proxypool_util-0.1.2.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7abb0a9c7c8d3544823df20c801fdde273672cdcec93da1f06aeed95b1765842 |
|
MD5 | e12593532f703c1af0663bd79fc1d32e |
|
BLAKE2b-256 | c721eb1c1ae98d8034ddcff7d36b70d2bc93de723896977291006ffeac792eb5 |
File details
Details for the file proxypool_util-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: proxypool_util-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a94fb587ef6f49b44717afe45f06b8de98098f71966ba64fd61eddd189180b3 |
|
MD5 | 9a0dbb054b2f7861b2c00492ed840964 |
|
BLAKE2b-256 | 849c6649058dd52684e4c8e2b571099c252934ffde8d1c2eb1f105d11815d6fd |