API Access Demo Example

      
  import _thread
  import time

  import requests

  headers = {
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
      "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 MicroMessenger/6.5.19 NetType/4G Language/zh_TW",
  }

  target = "https://ipinfo.io"

  extract_url = "extract url"  # example : https://server.711proxy.com/ip/pool/user/extract/pub/?zone=custom&ptype=5&count=1&proto=http&stype=json

  def testUrl(ip, port):
      proxy = {
          "http": f"http://{ip}:{port}",
          "https": f"http://{ip}:{port}",
      }
      try:
          res = requests.get(target, headers=headers, proxies=proxy, timeout=10)
          print(res.status_code, res.text)
      except Exception as e:
          print(e)
          pass

  req = requests.get(extract_url)
  ips = req.json().get("data")

  for v in ips:
      _thread.start_new_thread(testUrl, (v.get("ip", v.get("port"))))
      time.sleep(0.1)

  time.sleep(10)