import requests
def check_proxy(proxy):
try:
response = requests.get('http://example.com', proxies={'http': proxy, 'https': proxy}, timeout=10)
if response.status_code == 200:
print(f"Proxy {proxy} is working!")
else:
print(f"Proxy {proxy} is not working. Status code: {response.status_code}")
except Exception as e:
print(f"Proxy {proxy} is not working. Exception: {e}")
# Replace 'http://example.com' with the URL you want to use for testing
# Replace 'proxy_ip:port' with the actual proxy IP and port
proxy_to_check = 'proxy_ip:port'
check_proxy(proxy_to_check)
മാറ്റിസ്ഥാപിക്കുന്നത് ഉറപ്പാക്കുക 'proxy_ip:port'
നിങ്ങൾ പരിശോധിക്കാൻ ആഗ്രഹിക്കുന്ന യഥാർത്ഥ പ്രോക്സി ഐപിയും പോർട്ടും ഉപയോഗിച്ച്. ഈ സ്ക്രിപ്റ്റ് ഒരു അഭ്യർത്ഥന അയയ്ക്കുന്നു http://example.com
നൽകിയിരിക്കുന്ന പ്രോക്സി ഉപയോഗിച്ച്, പ്രതികരണ സ്റ്റാറ്റസ് കോഡ് 200 ആണോ എന്ന് പരിശോധിക്കുന്നു. സ്റ്റാറ്റസ് കോഡ് 200 ആണെങ്കിൽ, അത് പ്രോക്സി പ്രവർത്തിക്കുന്നുണ്ടെന്ന് പ്രിൻ്റ് ചെയ്യുന്നു; അല്ലെങ്കിൽ, അത് ഒരു പിശക് സന്ദേശം പ്രിൻ്റ് ചെയ്യുന്നു. ആവശ്യാനുസരണം URL, ടൈംഔട്ട് മൂല്യം എന്നിവ ക്രമീകരിക്കുക.
അഭിപ്രായങ്ങൾ (0)
ഇവിടെ ഇതുവരെ അഭിപ്രായങ്ങളൊന്നുമില്ല, നിങ്ങൾക്ക് ആദ്യത്തെയാളാകാം!