创建于:2021/2/27 7:59:47 阅读: 0
import requests
import time
import sys
import time
import hashlib
import base64
# 流量订单使用
_version = sys.version_info
is_python3 = (_version[0] == 3)
orderId = ""
secret = ""
host = "flow.hailiangip.com"
port = "14223"
user = "proxy"
timestamp = str(int(time.time())) # 计算时间戳
txt = "orderId=" + orderId + "&" + "secret=" + secret + "&" + "time=" + timestamp
if is_python3:
txt = txt.encode()
sign = hashlib.md5(txt).hexdigest() # 计算sign
password = 'orderId='+orderId+'&time='+timestamp+'&sign='+sign+"&pid=-1"+"&cid=-1"+"&uid="+"&sip=0"+"&nd=0"
targetUrl = "http://api.hailiangip.com:8422/api/myIp"
def httpProxyWithPassRequest(targetUrl):
proxyUrl = "http://" + user + ":" + password + "@" + host + ":" + port
proxy = {"http": proxyUrl,"https": proxyUrl}
r = requests.get(targetUrl,proxies=proxy)
print("status Code : " + str(r.status_code))
return
if __name__ == '__main__':
httpProxyWithPassRequest(targetUrl)
浏览 |
评论 0 |