Beispiel #1
0
def check_anony(proxy):
    _, x, body = curl_get("http://haha.pythonanywhere.com/realip", proxy)
    ips = re.findall(r"(?:\d+\.){3}\d+", body)

    if ips and ips[-1] == proxy["host"]:
        return "AP"
    return "UN"
Beispiel #2
0
 def check_proxy(proxy_list, wait_time, anony_type, inc):
     cur_num = -1
     cur_proxy = None
     while True:
         # print "{", inc[0], "}"
         #lock_time = time.time()
         with inc_lock:
             if inc[0] >= proxy_len:
                 break
             cur_num = inc[0]
             inc[0] += 1
         # print time.time() - lock_time
         if cur_num % 200 == 0:
             print "updated ", cur_num
         cur_proxy = proxy_list[cur_num]
         wait_time[cur_num], status_code, body = curl_get(
             url, proxy=cur_proxy)
         anony_type[cur_num] = check_anony(cur_proxy)
         if status_code != 200:
             wait_time[cur_num] = 1002