بايثون

علي احمد • منذ 4 سنوات

السلام عليكم

اريد استخدام بروكسي في برمجة البايثون ولا اعلم اي مكتبة استخدم هل من اقتراح مع شرح المكتبة

كلمات دليلية: python#

ساعد بالإجابة

"إن في قضاء حوائج الناس لذة لا يَعرفها إلا من جربها، فافعل الخير مهما استصغرته فإنك لا تدري أي حسنة تدخلك الجنة."

الإجابات (1)

Firas • منذ 4 سنوات

وعليكم السلام

أستخدم Py-Proxy 

مثال

from proxy import Proxy

proxy = Proxy()

# getting the current proxy
cur_proxy = proxy.proxy

# testing the current proxy
res = proxy.test_proxy(cur_proxy)

if res == 1:
	print("success!")
else:
	print("failure!")
	
# cycling the proxy to a new proxy from the pool
proxy.cycle()

# filtering proxies by a country code
proxy = Proxy("US") #gets US only proxies from the pool

# automatically validating proxies after fetching them
proxy = Proxy(validate_proxies=True)

# format a proxy for use with requests library
ip = "100.100.100.100" #example ip, not real
port = "1989" #example port, not real
addr = [ip, port]
proxies = proxy.format_proxy(addr) #returns the requests proxies dictionary

# validating all proxies concurrently
proxy.validate_proxies()

# cycling through valid only proxies
proxy.cycle(valid_only=True)

 

لايوجد لديك حساب في عالم البرمجة؟

تحب تنضم لعالم البرمجة؟ وتنشئ عالمك الخاص، تنشر المقالات، الدورات، تشارك المبرمجين وتساعد الآخرين، اشترك الآن بخطوات يسيرة !