dp.py 1.25 KB
Newer Older
liuxiaoxing committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
import requests
import json
import time
import random



headers = {'Content-Type': 'application/json'}
current_time_13 = int(round(time.time() * 1000))


#测试环境
# URL_install = 'http://10.3.20.39:10202/dpquery'
URL_install = 'http://link.trackingio.com/dpquery'
class allEvent:
    # 激活
    def dp_imei(self, i,  appkey):
        s = json.dumps({
	        "create_timestamp": current_time_13,
	        "imei": i,
	        "appid": appkey,
	        "device_id": i
})
        try:
            p = requests.post(url=URL_install, data=s, headers=headers, timeout=5)
            print("dp返回:" + p.text)
            # print("状态码:"+p.status_code)
            print("设备id:" + i)
liuxiaoxing committed
29
            print(p.url)
liuxiaoxing committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
        except Exception as err:
            print(err)

    # 激活
    def dp_ios(self, i,  appkey):
        s = json.dumps({
	        "create_timestamp": current_time_13,
	        "idfa": i,
	        "appid": appkey,
	        "device_id": i
})
        try:
            p = requests.post(url=URL_install, data=s, headers=headers, timeout=5)
            print("dp返回:" + p.text)
            # print("状态码:"+p.status_code)
            print("设备id:" + i)
            # print(p.url)
        except Exception as err:
            print(err)