test_get_ip_hailiangip.py 683 B

12345678910111213141516171819202122232425
  1. # -*- coding: utf-8 -*-
  2. import requests
  3. orderId = "O24112815252166905421"
  4. pwd = "Z4cBtneT"
  5. host = "flow.hailiangip.com"
  6. port = "14223"
  7. user = orderId
  8. password = 'pwd=' + pwd + "&pid=-1" + "&cid=-1" + "&uid=" + "&sip=0" + "&nd=0"
  9. targetUrl = "http://api.hailiangip.com:8422/api/myIp"
  10. def httpProxyWithPassRequest(targetUrl):
  11. proxyUrl = "http://" + user + ":" + password + "@" + host + ":" + port
  12. print(proxyUrl)
  13. proxy = {"http": proxyUrl, "https": proxyUrl}
  14. r = requests.get(targetUrl, proxies=proxy)
  15. print("status Code : " + str(r.status_code))
  16. print("response : " + r.text)
  17. return
  18. if __name__ == '__main__':
  19. httpProxyWithPassRequest(targetUrl)