import hashlib
import requests
import time
if __name__ == "__main__":
secret = 'ABCDEFGHIJKLMNOP'
params = {
"license": "L01234567890123P",
"time": int(time.time()),
"cnt": 100,
}
params["sign"] = hashlib.md5((params["license"] + str(params["time"]) + secret).encode('utf-8')).hexdigest()
try:
response = requests.get(
url="https://api-ip.abuyun.com/obtain",
params=params,
headers={
"Content-Type": "text/plain; charset=utf-8",
},
data="1"
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')