Free Proxy Library for requests library
Project description
Vats_Proxy
Free Proxy library for Python to use with requests library. Checks proxy connection&health while scraping proxies.
Installation
pip install vats_proxy
Get started
How to initiate ProxyManager and Use it: Example usages are shown below
ProxyManager(count=4) #Gets 4 free proxy
ProxyManager(count=4, test_url="http://www.yourtargetsite.com") # Gets 4 proxy and test proxies by making requets to test_url
#####Get One Proxy
from vats_proxy import ProxyManager
import requests
# Initialize Manager
proxy_manager = ProxyManager(count=1, test_url="http://www.yourtargetsite.com")
# Make request with proxy
proxy = proxy_manager.proxies.pop() # gets one proxy from proxy list
#proxy variable information:
#type: dict
#value example: {"http": "http://192.68.1.1:9954"}
request = requests.get("https://www.google.com", proxies=proxy)
#####Get Multiple Proxies and Make Each request with different proxy
from vats_proxy import ProxyManager
import requests
# Initialize Manager
proxy_manager = ProxyManager(count=5, test_url="http://www.yourtargetsite.com")
# Make request with proxy
for proxy in proxy_manager.proxies:
request = requests.get("https://www.google.com", proxies=proxy)
#####Handle Failed Proxy Connection
from vats_proxy import ProxyManager
import requests
from requests.exceptions import ProxyError
# Initialize Manager
proxy_manager = ProxyManager(count=1)
proxy = proxy_manager.proxies.pop()
try:
request = requests.get("https://www.google.com", proxies=proxy)
except ProxyError:
proxy = proxy_manager.request_proxy() # returns new proxy
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
vats_proxy-0.7.1.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for vats_proxy-0.7.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2df0edb79b786e025ee73a8fc22ea6bbe1f53e55b983155fe468e7dffdc2446e |
|
MD5 | f15c5c64b52ba628fae49acf23d637ab |
|
BLAKE2b-256 | 2765e83fef58a7e03864f21bce063f2fcd48d1bfbd2ed097f28dee0101a605e8 |