Rotating Proxy
v0.1.6
用於有效管理和利用旋轉代理的Python軟件包。該模塊提供了一種簡單有效的方法來處理多個代理,自動在它們之間切換以增強Web刮擦或任何需要匿名的HTTP請求。
您可以使用PIP安裝軟件包:
pip install rotating-proxy from rotating_proxy import ProxyPool , ProxySession
class Project :
def __init__ ( self ):
# Initialize the proxy pool with a list of proxies.
# Replace "127.0.0.1:80" with your own proxies in the format:
# ["http://proxy1","http://proxy2",..."http://proxyN"]
self . proxy_pool = ProxyPool ([ "http://127.0.0.1:80" ])
self . proxy_pool . filter_working_proxies ()
self . proxy_session = ProxySession ( self . proxy_pool )
def request_function ( self , ** kwargs ):
try :
response = self . proxy_session . request ( ** kwargs )
print ( f"IP Address: { response . json ()[ 'origin' ] } " )
except Exception as e :
print ( f"An error occurred: { str ( e ) } " )
if __name__ == "__main__" :
project = Project ()
project . request_function ( url = "https://httpbin.org/ip" , method = "GET" )歡迎捐款!如果您有改進或其他功能的建議,請隨時打開問題或提交拉動請求。
該項目已根據MIT許可獲得許可。有關詳細信息,請參見許可證文件。