python對接手機(jī)號碼歸屬地查詢接口DEMO示例
本文為您提供了python語言版本的IP地址查詢對接DEMO示例
手機(jī)號碼歸屬地查詢接口文檔 點擊下載
手機(jī)號碼歸屬地查詢接入指南 點擊訪問
#接口類型:互億無線手機(jī)號歸屬地查詢接口
#賬戶注冊:https://user.ihuyi.com/register.html
#注意事項:
#DEMO僅作參考
#此為python3版本
import requests
import json
import time
import hashlib
#接口地址
url = "https://api.ihuyi.com/appdev/mobile/Submit.json"
account = "APPID"
password = "APPKEY"
mobile = "136xxxxxxxx"
_now = str(int(time.time()))
password_raw = account + password + _now
# print(password_raw)
password_md5 = hashlib.md5(password_raw.encode(encoding="UTF-8")).hexdigest()
# print(password)
#定義請求的數(shù)據(jù)
data = {
"account":account,
# "password":password,
"password":password_md5,
"mobile":mobile,
"time":_now,
}
#定義請求的頭部
headers = {
"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"
}
#發(fā)起請求
response = requests.post(url, headers=headers, data=data)
#打印結(jié)果
print(response.content.decode())