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 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| import requests import jsonroot_url = "<your umami IP:port>/api/collect" header={ "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "zh,en-US;q=0.9,en;q=0.8,zh-TW;q=0.7,zh-CN;q=0.6", "Connection": "keep-alive", "Content-Length": "201", "Content-Type": "application/json", "Host": "uipv4.zywvvd.com:33030:3000", "Origin": "https://www.zywvvd.com", "Referer": "https://www.zywvvd.com/", "sec-ch-ua": '"Not_A Brand";v="99", "Google Chrome";v="109", "Chromium";v="109"', "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": "Windows", "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "cross-site", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36", "x-umami-cache": <your token> } data = { 'payload': { "website": <website-uuid>, "hostname": <your-host-name>, "screen": "1920x1080", "language": "zh", "url": "/", "event_type": "click-type", "event_name": "click", "event_value": "click-Umami" }, 'type': 'event' } url = root_url res = requests.post(url=url, data=json.dumps(data), headers=header) print(res) print(json.loads(res.text))
|