tkioreceiveandroid.py 1.9 KB
Newer Older
liuxiaoxing committed
1 2 3 4 5 6 7 8 9 10
import requests
import time
import json
import socket
import struct
import random
import hashlib

data = {
    "what": "install",
11
    "appid": "894ef23136b0a6bb039800aa217f2729",
liuxiaoxing committed
12 13
    "context": {
        "_deviceid": "",
liuxiaoxing committed
14 15
        "_imei": "",
        "_oaid": "",
liuxiaoxing committed
16 17
        "_ip": "",
        "_manufacturer": "vivo",
liuxiaoxing committed
18
        "_ryos": "android",
liuxiaoxing committed
19 20 21 22 23 24 25 26
        "_rydevicetype": "vivox9",
        "_networktype": "5g",
        "_resolution": "1344*750",
        "_carrier": "111",
        "_timestamp": 1655291783782,
        "_model": "jixing",
        "_ryosversion": "13.6.1",
        "__model": "jixing"
liuxiaoxing committed
27

liuxiaoxing committed
28 29 30 31 32 33 34 35 36 37 38 39 40
    },
    "when": int(round(time.time() * 1000)),
    "ds": "2022-06-15",
    "who": "lxx_test"
}

headers = {
    'Content-Type': 'application/json'
}

data_temp = json.dumps(data)


liuxiaoxing committed
41

liuxiaoxing committed
42 43 44
def send_request():
    global data
    # 测试
45
    # url = "http://52.80.137.106:8080/receive/tkio/install"
liuxiaoxing committed
46 47
    # url = "http://52.80.137.106:8080/receive/tkio/event"

liuxiaoxing committed
48
    # 线上
49
    url = "http://log.trackingio.com/receive/tkio/install"
liuxiaoxing committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
    data['context']['install_time'] = int(round(time.time() * 1000))
    print(data)
    response = requests.request("POST", url, headers=headers, data=json.dumps(data))
    print(response.text)
    # 全局data
    data = json.loads(data_temp)
    response = json.loads(response.text)
    s = str(response["status"])
    response["status"] = s
    return response


def send_requestlogin():
    global data
    # 测试
liuxiaoxing committed
65
    # url = "http://52.80.137.106:8080/receive/tkio/loggedin"
liuxiaoxing committed
66
    # 线上
liuxiaoxing committed
67
    url = "http://log.trackingio.com/receive/tkio/loggedin"
liuxiaoxing committed
68 69 70 71 72 73 74 75 76 77 78 79
    data['context']['install_time'] = int(round(time.time() * 1000))
    print(data)
    response = requests.request("POST", url, headers=headers, data=json.dumps(data))
    print(response.text)
    # 全局data
    data = json.loads(data_temp)
    response = json.loads(response.text)
    s = str(response["status"])
    response["status"] = s
    return response