Proxy Manager
Project description
This module loads and uses a proxy for the convenience of using requests, aiohttp, etc.
Fork https://pypi.org/project/proxy-manager/
Installation
This module is available via pip:
$ pip install proxy-MGR
Basic Usage
proxies.txt:
https://00.11.222.33:4444
https://55.66.77.88:9999@username:password
socks5://10.11.121.13:1414@username:password
15.16.171.18:1919
20.21.222.23:2424@username:password
25.26.272.28:2929:username:password
test.py:
from ProxyMGR import ProxyMGR
MGR = ProxyMGR("proxies.txt")
# MGR = ProxyMGR(proxy_list=["00.11.222.33:4444@username:password"])
# Random proxy
random_proxy = MGR.random_proxy()
print(random_proxy) # https://00.11.222.33:4444
# Next proxy
proxy = MGR.next_proxy()
print(proxy) # https://00.11.222.33:4444
proxy = MGR.next_proxy()
print(proxy) # https://55.66.77.88:9999@username:password
proxy = MGR.next_proxy()
print(proxy) # socks5://10.11.121.13:1414@username:password
# Proxy dict
print(random_proxy.get_dict()) # {'http': 'https://00.11.222.33:4444', 'https': 'https://00.11.222.33:4444'}
# Proxy info
print(random_proxy.get_info()) # {"ip":"81.222.188.37","success":true,"type":"IPv4","continent":"Europe" ...
Documentation
Proxy File Format
Proxies in proxy files must have one of the following formats:
ip:port
ip:port:username:password
ip:port@username:password
http://ip:port
...
These can be combined and alternated.
ProxyMGR
ProxyMGR(proxy_file_path)
ProxyMGR(proxy_list)
Parameters
proxy_file_path(string) — File path to the proxy (Required, if proxy_list is not specified)proxy_list(list) — List proxy (Required, if proxy_file_path is not specified)default_type(string) — Default proxy type (exampleip:port->https://ip:port) (optional)
ProxyMGR.random_proxy()
Returns a random proxy of those loaded into the proxy manager
ProxyMGR.next_proxy()
Parameters
loop(bool) — Repeat proxies if they run out
ProxyMGR.get_dict()
dict - Proxy as a dict in the form {'http':'http://...', 'https':'https://...'} for use with requests
ProxyMGR.get_info()
Website Request https://ipwho.is with proxy and return json
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file proxy_mgr-0.1.0.tar.gz.
File metadata
- Download URL: proxy_mgr-0.1.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.0 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fddb1bf986e9f1d6a4133ca803961cd7af234dd444bd8b975b38bd5121d4748
|
|
| MD5 |
1877af353877ba95e0b3b802df28cae9
|
|
| BLAKE2b-256 |
d1846c0fa04909781da7d5907bc7873002332ad6c0f71f585366244ee090b5cc
|
File details
Details for the file proxy_mgr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: proxy_mgr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.0 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1efc9867dbf2034a9e6a4c505e1c61db68a5679732e9eae395c4e7436c3f036d
|
|
| MD5 |
5e5ccd3759a41b0aa963fe367b2f0d88
|
|
| BLAKE2b-256 |
a9e59f33b633dc3d180be355687c94aebd41f0480209af32193580554f16e1dc
|