Commit 063502f0 by liuxiaoxing

test

parent f5231139
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="NewPython 3.7 (test)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="NewPython 3.7 (test)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
tkio python接口测试代码
\ No newline at end of file
......@@ -25,12 +25,12 @@ newList = ['364112464174', '987448857634', '823325548389', '774510604807', '5026
# 遍历已有列表数据 发请求
# for i in newList:
# ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
# # allEvent().startupUpload(i,ip,appkey,JDClass)
# allEvent().eventUpload(i,ip,appkey,'2',JDClass)
# # allEvent().pageUpload(i,ip,appkey,'1',JDClass)
# # allEvent().exitUpload(i,ip,appkey,JDClass)
for i in newList:
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
# allEvent().startupUpload(i,ip,appkey,JDClass)
allEvent().eventUpload(i,ip,appkey,'2',JDClass)
# allEvent().pageUpload(i,ip,appkey,'1',JDClass)
# allEvent().exitUpload(i,ip,appkey,JDClass)
......@@ -40,11 +40,11 @@ for _ in range(1):
# 随机生成ip
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
# ip = '103.23.28.70'
allEvent().installUpload(i,ip,appkey,JDClass)
allEvent().startupUpload(i,ip,appkey,JDClass)
# allEvent().installUpload(i,ip,appkey,JDClass)
# allEvent().startupUpload(i,ip,appkey,JDClass)
allEvent().eventUpload(i,ip,appkey,'0',JDClass)
allEvent().pageUpload(i,ip,appkey,'0',JDClass)
allEvent().exitUpload(i,ip,appkey,JDClass)
# allEvent().pageUpload(i,ip,appkey,'0',JDClass)
# allEvent().exitUpload(i,ip,appkey,JDClass)
lst.append(i)
print(lst)
......
......@@ -8,69 +8,81 @@ import hashlib
#安卓常规渠道激活
appkey = '6bc175c5f1ffa1fb8dce2196cb644de2'
appkey = '519dd48e4162eb4f059d8ff91c307477'
# 线上预约app
# 7f64fbd64513bc74aa6b5bf753ae0953
# 16dc0cb882d3dbec4f7f66251a84d6dd
# 7e3aa681f68435b3f74de790d6424690
event = 'event_1'
# s = 12
# event = "event_20"
# ------------周六测试内容-----------------,已写好的是分包的deeplink和分包
# 6bc175c5f1ffa1fb8dce2196cb644de2
# deeplink设备
# 150143490356
lst = []
newList = ['150143490356']
# lst = []
# newList = ['452444118382']
# # 遍历已有列表数据 发请求
# for i in newList:
# ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
# allEvent().payEvent(i, ip, appkey)
for index in range(1):
# 随机生成12为数组
s = ''.join(str(random.choice(range(10))) for _ in range(18))
p = ''.join(str(random.choice(range(10))) for _ in range(12))
se = ''.join(str(random.choice(range(10))) for _ in range(12))
adid = ''.join(str(random.choice(range(10))) for _ in range(12))
# adid = '598471615567'
# 遍历已有列表数据 发请求
for i in newList:
# p = '987654321234567'
# s = '2321321312h8ro321'
# i = ''.join(str(random.choice(range(10))) for _ in range(12))
i = '213416723004'
# i = '00000000-0000-0000-0000-000000000000'
# 随机生成ipXXXX XXCB489741-0029-4A35-8E38-D142F836B623
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
allEvent().payEvent(i, ip, appkey)
# for _ in range(1):
# # 随机生成12为数组
# s = ''.join(str(random.choice(range(10))) for _ in range(18))
# p = ''.join(str(random.choice(range(10))) for _ in range(12))
# se = ''.join(str(random.choice(range(10))) for _ in range(12))
# adid = ''.join(str(random.choice(range(10))) for _ in range(12))
# # adid = '598471615567'
#
# # p = '987654321234567'
# # s = '2321321312h8ro321'
# # i = ''.join(str(random.choice(range(10))) for _ in range(12))
# # i = '93.55.87.164'
# # i = '00000000-0000-0000-0000-000000000000'
# i = '150143490356'
# # 随机生成ipXXXX XXCB489741-0029-4A35-8E38-D142F836B623
# ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
# # ip = '13.114.105.112'
# # 地域测试ip
# # 60.13.148.23 新疆维吾尔自治区吐鲁番市
# # 61.139.239.255 广西壮族自治区北海市
# # 119.60.0.0 宁夏回族自治区银川市
#
# # allEvent().installUpload(i, ip, appkey)
# # time.sleep(5)
# # allEvent().startupEvent(i, ip, appkey)
# # allEvent().loginEvent(i, ip, appkey)
# # allEvent().registerEvent(i, ip, appkey)
# allEvent().payEvent(i, ip, appkey)
# # allEvent().ziding_event(i, ip, appkey, event)
# # allEvent().payorder(i, ip, appkey)
# # allEvent().adshow(i,ip,appkey,adid)
# # allEvent().adclick(i,ip,appkey,adid)
# # allEvent().pageduration(i,ip,appkey,se,p)
# # allEvent().appduration(i,ip,appkey,s)
# # allEvent().invoke_test(i,ip,appkey)
# # allEvent().retentionEvent(i, ip, appkey)
# #
# # allEvent().formevent(i,ip,appkey)
# # allEvent().batchUpload(i,ip,appkey)
# # allEvent().H5(i,ip,appkey)
# print("imei:"+i)
# # print("pageid:"+p)
# # print(s)
# ip = '12.23.21.2'
# 地域测试ip
# 60.13.148.23 新疆维吾尔自治区吐鲁番市
# 61.139.239.255 广西壮族自治区北海市
# 119.60.0.0 宁夏回族自治区银川市
# allEvent().installUpload(i, ip, appkey)
# time.sleep(1)
# allEvent().startupEvent(i, ip, appkey)
# time.sleep(1)
# allEvent().loginEvent(i, ip, appkey)
# time.sleep(1)
# allEvent().registerEvent(i, ip, appkey)
# allEvent().payEvent(i, ip, appkey)
# time.sleep(1)
# allEvent().payorder(i, ip, appkey)
# time.sleep(1)
# num = index + 1
# event = 'event_' + str(num)
event = 'event_20'
allEvent().ziding_event(i, ip, appkey, event)
# print(s)
# s = int(s) + 1
# time.sleep(3)
# allEvent().adshow(i,ip,appkey,adid)
# allEvent().adclick(i,ip,appkey,adid)
# allEvent().pageduration(i,ip,appkey,se,p)
# allEvent().appduration(i,ip,appkey,s)
# allEvent().invoke_tewst(i,ip,appkey)
# allEvent().retentionEvent(i, ip, appkey)
#
# allEvent().formevent(i,ip,appkey)
# allEvent().batchUpload(i,ip,appkey)
# allEvent().H5download(i,ip,appkey)
# time.sleep(1)
# allEvent().H5pv(i,ip,appkey)
# time.sleep(1)
#
# allEvent().H5su(i,ip,appkey)
print("imei:"+i)
# print("pageid:"+p)
# print(s)
# print(ip)
......
......@@ -8,17 +8,17 @@ import time
#向短链发送点击数据
#!!!!分包需要删掉https的s
URL = 'http://uri6.com/tkio/BbQZnqa?noredirect=true'
URL = 'http://uri6.com/tkio/RZFFFba?noredirect=true&callback= http%3A%2F%2Fad.toutiao.com%2Ftrack%2Factivate%2F%3Fcallback%3DCKP4rs-Zn4QDEKiQ6teZn4QDGN6L8Y-h9Wcg3ovxj6H1ZyiE0PjgroSEAzAOOM_X-8IDQik0YWY1NzdlOC1lZmViLTRmZDEtYmZkZC00MzE1Zjc1MmJhMGF1NTQ5M0iA0pOtA1AAiAEAkAECmAEA%26os%3D0%26muid%3D'
appkey = '74933b9c672979161123df2a4d67e8be'
event = 'invoke'
cmpaignid = '223344'
appkey = '16dc0cb882d3dbec4f7f66251a84d6dd'
# event = 'invoke'
cmpaignid = '233445'
# 广告创意ID
ry_adcreative_id = '999'
ry_adcreative_id = '9876543'
# 广告组ID
ry_adgroup_id = '999'
ry_adgroup_id = '65432'
# 广告计划ID
ry_adplan_id = '999'
ry_adplan_id = '4321'
# 广告组名称
ry_adgroup_name = '广告组'
# 广告计划名称
......@@ -27,30 +27,38 @@ ry_adplan_name = '广告计划'
ry_adcreative_name = '广告创意'
s = 0
w = 0
for _ in range(1):
for index in range(30):
#随机生成12为数组
i = ''.join(str(random.choice(range(10))) for _ in range(12))
# i = '167070728336'
# i = '16707072833653'
#随机生成ip
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
# ip = '175.93.28.70'
accountid = ''.join(str(random.choice(range(10))) for _ in range(12))
# accountid = '014067084301'
try:
parms = {
# 'androidid': "43214532142142",
'imei': i,
# "idfa": 'DBC13622-E34B-440C-B7A7-FB6641D0D9AB',
'ip': ip,
# 'campuuid': '14323122',
# 'clickid': '3232331',
# "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3",
# 'creativeId':'21321321312123',
# 'requestId':'312321321312',
# 'adId': long('21231'),
# 'ry_adgroup_name': ry_adgroup_name,
# 'ry_adplan_name': ry_adplan_name,
# 'ry_adcreative_name': ry_adcreative_name,
# "ry_adgroup_id": ry_adgroup_id,
# "ry_adplan_id": ry_adplan_id,
# "ry_adcreative_id": ry_adcreative_id,
'ry_adgroup_name': ry_adgroup_name,
'ry_adplan_name': ry_adplan_name,
'ry_adcreative_name': ry_adcreative_name,
"ry_adgroup_id": ry_adgroup_id,
"ry_adplan_id": ry_adplan_id,
"ry_adcreative_id": ry_adcreative_id,
"accountid": accountid
}
#timeout可以超时四秒
......@@ -68,13 +76,19 @@ for _ in range(1):
print('imei:', i)
print('ip', ip)
w = w+1
time.sleep(15)
try:
allEvent().installUpload(i, ip, appkey, cmpaignid)
except Exception as err:
print('install_wrong:', w)
w = w + 1
print(err)
# time.sleep(8)
# try:
# allEvent().installUpload(i, ip, appkey, cmpaignid)
# except Exception as err:
# print('install_wrong:', w)
# w = w + 1
# print(err)
# try:
# allEvent().invoke_test(i, ip, appkey, cmpaignid)
# except Exception as err:
# print('install_wrong:', w)
# w = w + 1
# print(err)
# time.sleep(1)
# try:
# allEvent().registerEvent(i, ip, appkey)
......@@ -92,7 +106,10 @@ for _ in range(1):
# allEvent().payEvent(i, ip, appkey)
# except Exception:
# print('付费_wrong:', w)
# time.sleep(10)
# num = index + 1
# event = 'event_' + str(num)
# event = 'event_28'
# time.sleep(3)
# try:
# allEvent().ziding_event(i, ip, appkey,event)
# except Exception:
......
......@@ -8,21 +8,24 @@ import time
appkey = '16dc0cb882d3dbec4f7f66251a84d6dd'
#57ed2dd31596bb4682471e82c0c73c1a
# 4b25b8a4dc584e63e9a7b81c3adedf2f
event = 'event_10'
# event = 'event_10'
cmpaignid = '12121'
for _ in range(1):
cmpaignid = '233445'
for index in range(1):
# 随机生成12为数组
# i = ''.join(str(random.choice(range(10))) for _ in range(12))
i = '453829618586'
i = '691007221237'
# 随机生成ip
# ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
ip = '143.205.125.236'
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
# ip = '143.205.125.236'
# allEvent().installUpload(i, ip, appkey, cmpaignid)
# time.sleep(3)
# allEvent().loginEvent(i, ip, appkey)
# allEvent().orderEvent(i, ip, appkey)
allEvent().orderEvent(i, ip, appkey)
time.sleep(1)
# num = index + 1
# event = 'event_' + str(num)
# allEvent().ziding_event(i, ip, appkey,event)
allEvent().payEvent(i, ip, appkey)
# allEvent().registerEvent(i, ip, appkey)
......
......@@ -7,11 +7,9 @@ import time
import string
#向短链发送点击数据
#渠道短链
URL = 'http://10.2.20.42:8083/tkio/iEJrAra?noredirect=true'
appkey = '74b81be2432c029040e0b2bc375ce7fb'
URL = 'http://uri6.com/tkio/zy2aEba?noredirect=true'
appkey = '0d401839250deff23daf62fd49a444cb'
# URL = 'http://172.31.19.255:8083/tkio/VNNjQra'
event = 'event_1'
# 广告创意ID
......@@ -42,7 +40,7 @@ for _ in range(1):
i = (a+"-"+b+"-"+c+"-"+d+"-"+e).upper()
# i = '00000000-0000-0000-0000-000000000000'
# i = 'YEFVBQKJ-GZWT-LRVC-CX05-KNZRBB1P0WXQ'
# i = 'IFV_05B50501-E0FC-4B83-BE74-F18ACEDEF37Bwew'
adid = ''.join(str(random.choice(range(10))) for _ in range(12))
p1 = ''.join(str(random.choice(range(10))) for _ in range(12))
se = ''.join(str(random.choice(range(10))) for _ in range(12))
......@@ -55,9 +53,12 @@ for _ in range(1):
try:
parms = {
'idfa': i.upper(),
'idfa': i,
# 'idfa_MD5': '41C0DAEB7866756542666118D6ADF473',
# 'idfv': 'IFV_05B50501-E0FC-4B83-BE74-F18ACEDEF37Bwew',
# 'oaid_MD5': 'FCAF473729CE701E95A9422F5FBCD607',
# 'muid':i,
# 'oaid':'00000000000000000000000000000000',
# 'oaid':'654324352124312232',
'ip': ip,
# 'ua': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 SP-engine/2.30.0 baiduboxapp/12.13.0.10 (Baidu; P2 13.6.1)',
# ios
......@@ -130,17 +131,17 @@ for _ in range(1):
# except Exception:
# print('install_wrong:', w)
# w = w + 1
time.sleep(5)
try:
allEvent().registerEvent(i, ip, appkey)
except Exception as e:
print('注册_wrong:', w)
print(e)
time.sleep(4)
try:
allEvent().loginEvent(i, ip, appkey)
except Exception:
print('登录_wrong:', w)
# time.sleep(5)
# try:
# allEvent().registerEvent(i, ip, appkey)
# except Exception as e:
# print('注册_wrong:', w)
# print(e)
# time.sleep(4)
# try:
# allEvent().loginEvent(i, ip, appkey)
# except Exception:
# print('登录_wrong:', w)
# time.sleep(5)
# try:
# allEvent().ziding_event(i, ip, appkey, event)
......
......@@ -7,8 +7,8 @@ import random
headers = {'Content-Type': 'application/json'}
# URL = 'http://10.2.20.42:8080/receive/tkio/'
URL = 'http://log.trackingio.com/receive/tkio/'
URL = 'http://10.2.20.42:8080/receive/tkio/'
# URL = 'http://log.trackingio.com/receive/tkio/'
# URL = 'http://jisulog.sortda.com/receive/tkio/'
#时间戳
......@@ -66,9 +66,12 @@ class allEvent:
"appid":appkey,
"context":{
# "_cmpaignid":'default',
"_deviceid":i,
# 00000000 - 0000 - 0000 - 0000 - 000000000000
"_idfa":i,
"_deviceid": i,
# 00000000-0000-0000-0000-000000000000
# 45F38BD4-64DA-485E-BAFD-D1ECEBBCAF18
"_idfa": i,
# "_oaid":'45F568D4-68DA-875E-BAFD-D3ECEBBCAU56',
# "_idfv": i,
"_ip": IP,
# 'ua': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 SP-engine/2.30.0 baiduboxapp/12.13.0.10 (Baidu; P2 13.6.1)',
'_manufacturer': manufacturer,
......@@ -83,45 +86,38 @@ class allEvent:
'__model': 'jixing',
# 1.redownload + deviceId有归因结果 asa_install_type = old_redownload对应3
# 2.redownload + deviceId无归因结果 asa_install_type = new_redownload对应4
# 3.download + deviceId有归因结果asa_install_type = old_download对应1
# 4.download + deviceId无归因结果asa_install_type = new_download对应2
#
#
# # 转化类型,新增或重装,Download 或 Redownload
"iad-conversion-type": "Redownload",
"iad-conversion-type": "Download",
# 广告活动组ID(campaign group id)
"iad-org-id": "12123",
"iad-org-id": "764352453453",
# 广告活动组名称(campaign group name)
"iad-org-name": "12345678",
"iad-org-name": "name",
# 广告活动ID
"iad-campaign-id": "99999999999",
"iad-campaign-id": "111",
# 广告活动名称
"iad-campaign-name": "CampaignName",
# 广告组ID
"iad-adgroup-id": "99999999999",
"iad-adgroup-id": "111111",
# 广告组名称
"iad-adgroup-name": "AdGroupName",
# 关键词 id
"iad-keyword-id": "99999999999",
"iad-keyword-id": "111",
# 关键词
"iad-keyword": "Keyword",
# 素材ID
"iad-creativeset-id": "99999999999",
"iad-creativeset-id": "111",
# 素材名称
"iad-creativeset-name": "CreativeSetName",
......
......@@ -6,10 +6,10 @@ import string
import time
#iOS常规渠道激活
appkey = '094673b49cbad98c811df7d7ba5b5d80'
appkey = '0e4ab9b7523030e273e75d7898c7470a'
event = 'event_1'
for _ in range(1):
for index in range(1):
# 随机生成12为数组
a = "".join(random.sample(string.ascii_letters + string.digits, 8))
b = "".join(random.sample(string.ascii_letters + string.digits, 4))
......@@ -18,27 +18,25 @@ for _ in range(1):
e = "".join(random.sample(string.ascii_letters + string.digits, 12))
i = (a + "-" + b + "-" + c + "-" + d + "-" + e).upper()
# i = 'UMY2TRHE-Y2OL-UDTI-4JV9-CX8BVT6LW3GF'
# i = 'R8DUK9OE-8QBE-W8YJ-TFP1-A6W3KZEVGYU2'
print(i)
adid = ''.join(str(random.choice(range(10))) for _ in range(12))
# 生成正常的idfa
# 随机生成ip
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
# ip = '191.156.121.201'
# ip = '61.192.125.69'
allEvent().installUpload(i,ip,appkey)
# allEvent().startupEvent(i, ip, appkey)
# time.sleep(10)
# allEvent().loginEvent(i, ip, appkey)
# allEvent().registerEvent(i, ip, appkey)
# allEvent().payEvent(i, ip, appkey)
# time.sleep(1)
# allEvent().payorder(i, ip, appkey)
# time.sleep(3)
# num = index + 1
# event = 'event_' + str(num)
# allEvent().ziding_event(i, ip, appkey, event)
# print(event)
# allEvent().adshow(i,ip,appkey,adid)
# allEvent().adclick(i,ip,appkey,adid)
# allEvent().pageduration(i,ip,appkey,se,p)
......
......@@ -97,7 +97,7 @@ data_temp = json.dumps(data)
def send_request():
global data
url = "http://tkiomicro-receive-788931749.cn-north-1.elb.amazonaws.com.cn/receive/tkiov2/sdk"
# print(data)
print(data)
response = requests.request("POST", url, headers=headers, data=json.dumps(data))
print(response.text)
# 全局data
......@@ -147,7 +147,7 @@ def test_piliang2():
data.append(data[0])
response = send_request()
assert response["status"] == "406"
assert response["status"] == "407"
......@@ -1205,7 +1205,7 @@ def test_event_name7():
# event_type为custom,event_name为preset中的固定参数
def test_event_name7():
def test_event_name8():
newList = ['install', 'startup', 'register', 'login', 'order', 'purchase',
'adimpression', 'adclick']
for event in newList:
......@@ -1297,7 +1297,6 @@ def test_register_type4():
for event in newList:
data[0]["event_info"]["event_data"]['register_type'] = ""
data[0]['event_info']['event_name'] = event
response = send_request()
assert response["status"] == "0"
......
......@@ -97,6 +97,7 @@ def send_request():
# os为ios,channel_name不等于default
def test_os_ios():
data[0]["device_info"]["os"] = 'ios'
data[0]['application_info']['channel_name'] = 'xiaomi'
response = send_request()
......@@ -237,10 +238,8 @@ def test_idfv_md52():
response = send_request()
assert response["status"] == "125"
def test_for():
sz = ["1"]
for _ in range(5):
sz.append("2")
if __name__ == '__main__':
pytest.main()
import requests
import json
import time
import pytest
url1 = 'http://tmtest.trackingio.com/receive/turl/3r5K1h9'
current_time_13 = int(round(time.time() * 1000))
zf35 = '54321422322132132131213133322323233'
zf130 = 'xiaomi小米小米xiaomi小米小米xiaomi小米小米xiaomi小米小米xiaomi小米小米小米xiaomi小米xiaomi小米xiaomi小米xiaomi小米xiaomi小米xiaomi'
zf64 = 'xiaomi小米小米xiaomi小米小米xiaomi小米小米xiaomi小米小米xiaomi小'
zf468 = '1.2.23.3.4.4232.213123.13.23.213.123.123.213.21.321.3.213.12.321.3.21.321.3.121.2.23.3.4.4232.213123.13.23.213.123.123.2131.2.23.3.4.4232.213123.13.23.213.123.123.213.21.321.3.213.12.321.3.21.321.3.121.2.23.3.4.4232.213123.13.23.213.123.123.213.21.321.3.213.12.321.3.21.321.3.121.2.23.3.4.4232.213123.13.23.213.123.123.213.21.321.3.213.12.321.3.21.321.3.12.21.321.3.213.12.321.3.21.321.3.121.2.23.3.4.4232.213123.13.23.213.123.123.213.21.321.3.213.12.321.3.21.321.3.12'
zf668 = 'Mozilla/5.0 (Linux; U; Android 7.0; zh-cn; Nexus 5X Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/37.0.0.0 MQQBrowser/7.3 Mobile Safari/537.36Mozilla/5.0 (Linux; U; Android 7.0; zh-cn; Nexus 5X Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/37.0.0.0 MQQBrowser/7.3 Mobile Safari/537.36Mozilla/5.0 (Linux; U; Android 7.0; zh-cn; Nexus 5X Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/37.0.0.0 MQQBrowser/7.3 Mobile Safari/537.36Mozilla/5.0 (Linux; U; Android 7.0; zh-cn; Nexus 5X Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/37.0.0.0 MQQBrowser/7.3 Mobile Safari/537.36'
global parms
parms = {
# 触点传参时间。is_s2s=1时必传,0时选传。不同渠道有可能传多种格式,详见需求。限制32位字符内。短链传参。
......@@ -17,34 +28,11 @@ parms = {
'ipv6': '1.1.1.1',
# 用户代理信息。限制512字符内。is_s2s=1时都必传,0时都选传,0时优先取传参UA,未传参或报错时,取http header中的user agent作为ua的值
'ua': 'Mozilla/5.0 (Linux; U; Android 7.0; zh-cn; Nexus 5X Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/37.0.0.0 MQQBrowser/7.3 Mobile Safari/537.36',
# Android OAID原值。限制512字符内。Android选传,app_platform=ios时报错
'oaid': '3DEA635F-B24F-434B-833F-4ED028FEAEEF',
# Android OAID原值MD5后转小写。固定为32字符。Android选传,app_platform=ios时报错
'oaid_md5': '8e488a40a17aed2f6752f51382a4eafc',
# Android主卡IMEI原值。限制32字符内。Android选传,app_platform=ios时报错
'imei1': '8342732742383',
# Android主卡IMEI原值MD5后转小写。固定为32字符。Android选传,app_platform=ios时报错
'imei1_md5': '8e488a40a17aed2f6752f51382a4eafc',
# Android副卡IMEI原值。限制32字符内。Android选传,app_platform=ios时报错
'imei2': '8342732742383',
# Android副卡IMEI原值MD5后转小写。固定为32字符。Android选传,app_platform=ios时报错
'imei2_md5': '8e488a40a17aed2f6752f51382a4eafc',
# Google Advertising ID原值。固定36字符。Android选传,app_platform=ios时报错
'gaid': 'B21C5EC5-9921-42FD-AAC5-07A0EB6CF1A0',
# Google Advertising ID原值MD5后转小写。固定为32字符。Android选传,app_platform=ios时报错
'gaid_md5': '8e488a40a17aed2f6752f51382a4eafc',
# //MAC原值。固定17字符。Android选传,app_platform=ios时报错
'mac': '',
# MAC原值MD5后转小写。固定为32字符。Android选传,app_platform=ios时报错
'mac_md5': '',
# Android ID原值。固定16字符。Android选传,app_platform=ios时报错
'android_id': '',
# Android ID原值MD5后转小写。固定为32字符。Android选传,app_platform=ios时报错
'android_id_md5': '',
# 监测短链id。固定7位。
# 'turl_id': '3r5K1h9',
# 全部url参数。
# 'tkul_string': 'xxx',
# iOS IDFA原值。固定为36字符
"idfa": "3DEA635F-B24F-434B-833F-4ED028FEAEEF",
"idfa_md5": "8e488a40a17aed2f6752f51382a4eafc",
"idfv": "3DEA635F-B24F-434B-833F-4ED028FEAEEF",
"idfv_md5": "8e488a40a17aed2f6752f51382a4eafc",
# 触点类型。固定为click。都必传
'touchpoint_type': 'click',
# 归因类型。固定为ua(user acquirement新客获取)
......@@ -90,24 +78,225 @@ parms = {
# 自定触点参数集合。都选传。
# 'custom_params_1': ''
}
data_temp = json.dumps(parms)
# p = requests.get(url=url1, params=parms, timeout=10, verify=False)
# print(p.url)
# print(p.status_code)
# print(p.content)
def send_request(dl, cs):
url1 = 'http://tmtest.trackingio.com/receive/turl/'+dl + cs
global parms
url1 = 'http://tmtest.trackingio.com/receive/turl/' + dl + cs
response = requests.get(url=url1, params=parms, timeout=10, verify=False)
print(response.url)
parms = json.loads(data_temp)
response = json.loads(response.text)
return response
def test_aaa():
# parms['is_s2s'] = '0'
re = send_request('3r5K1h9', '')
# idfa为空
def test_idfa1():
parms['idfa'] = ''
re = send_request('nEFnQra', '')
assert re["status"] == 0
# idfa为全0
def test_idfa2():
parms['idfa'] = '00000000-0000-0000-0000-000000000000'
re = send_request('nEFnQra', '')
assert re["status"] == 0
# idfa为32字符
def test_idfa3():
parms['idfa'] = '3DEA635F-B24F-434B-833F-4ED028FEAEEF'
re = send_request('nEFnQra', '')
assert re["status"] == 0
# idfa非32字符
def test_idfa4():
parms['idfa'] = zf35
re = send_request('nEFnQra', '')
assert re["status"] == 124
# idfa_md5为空
def test_idfa_md51():
parms['idfa_md5'] = ''
re = send_request('nEFnQra', '')
assert re["status"] == 0
# idfa_md5为全0 md5加密
def test_idfa_md52():
parms['idfa_md5'] = '9f89c84a559f573636a47ff8daed0d33'
re = send_request('nEFnQra', '')
assert re["status"] == 0
# idfa_md5为32字符
def test_idfa_md53():
parms['idfa_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('nEFnQra', '')
assert re["status"] == 0
# idfa_md5非32字符
def test_idfa_md54():
parms['idfa_md5'] = zf35
re = send_request('nEFnQra', '')
assert re["status"] == 187
# idfv和idfv_md5同上
# idfv为空
def test_idfv1():
parms['idfv'] = ''
re = send_request('nEFnQra', '')
assert re["status"] == 0
# idfv为全0
def test_idfv2():
parms['idfv'] = '00000000-0000-0000-0000-000000000000'
re = send_request('nEFnQra', '')
assert re["status"] == 0
# idfv为32字符
def test_idfv3():
parms['idfv'] = '3DEA635F-B24F-434B-833F-4ED028FEAEEF'
re = send_request('nEFnQra', '')
assert re["status"] == 0
# idfv非32字符
def test_idfv4():
parms['idfv'] = zf35
re = send_request('nEFnQra', '')
assert re["status"] == 125
# idfv_md5为空
def test_idfv_md51():
parms['idfv_md5'] = ''
re = send_request('nEFnQra', '')
assert re["status"] == 0
# idfv_md5为全0 md5加密
def test_idfv_md52():
parms['idfv_md5'] = '9f89c84a559f573636a47ff8daed0d33'
re = send_request('nEFnQra', '')
assert re["status"] == 0
# idfv_md5为32字符
def test_idfv_md53():
parms['idfa_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('nEFnQra', '')
assert re["status"] == 0
# idfv_md5非32字符
def test_idfv_md54():
parms['idfv_md5'] = zf35
re = send_request('nEFnQra', '')
assert re["status"] == 188
# 短链是ios,传oaid
def test_oaid():
parms['oaid'] = '3DEA635F-B24F-434B-833F-4ED028FEAEE'
re = send_request('nEFnQra', '')
assert re["status"] == 115
# 短链是ios,传oaid_md5
def test_oaid_md5():
parms['oaid_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('nEFnQra', '')
assert re["status"] == 115
# 短链是ios,传imei1
def test_imei1():
parms['imei1'] = '8342732742383'
re = send_request('nEFnQra', '')
assert re["status"] == 115
# 短链是ios,传imei1_md5
def test_imei1_md5():
parms['imei1_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('nEFnQra', '')
assert re["status"] == 115
# 短链是ios,传imei2
def test_imei2():
parms['imei2'] = '8342732742383'
re = send_request('nEFnQra', '')
assert re["status"] == 115
# 短链是ios,传imei2_md5
def test_imei2_md5():
parms['imei2_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('nEFnQra', '')
assert re["status"] == 115
# 短链是ios,传gaid
def test_gaid():
parms['gaid'] = 'B21C5EC5-9921-42FD-AAC5-07A0EB6CF1A0'
re = send_request('nEFnQra', '')
assert re["status"] == 115
# 短链是ios,传gaid_md5
def test_gaid_md5():
parms['gaid_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('nEFnQra', '')
assert re["status"] == 115
# 短链是ios,传mac
def test_mac():
parms['mac'] = 'B21C5EC5-9921-42FD-AAC5-07A0EB6CF1A0'
re = send_request('nEFnQra', '')
assert re["status"] == 115
# 短链是ios,传mac_md5
def test_mac_md5():
parms['mac_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('nEFnQra', '')
assert re["status"] == 115
# 短链是ios,传android_id
def test_android_id():
parms['android_id'] = '1a34fc556a43c453'
re = send_request('nEFnQra', '')
assert re["status"] == 115
# 短链是ios,传android_id_md5
def test_android_id_md5():
parms['android_id'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('nEFnQra', '')
assert re["status"] == 115
if __name__ == '__main__':
pytest.main()
......@@ -3,7 +3,7 @@ import struct
import socket
import random
#iOS常规渠道激活
appkey = '0d401839250deff23daf62fd49a444cb'
appkey = '3f2706b7afdf89d95ffa7d2e9cc13e2e'
for _ in range(2):
# 随机生成12为数组
......
# from numpy import long
from android_event.android_script import allEvent
import random
import requests
import socket
import struct
import time
import datetime
# 导入hashlib模块进行md5操作
import hashlib
# from jiami.md5 import get_str_sha1_secret_str
# 向短链发送点击数据
# 广告创意ID
ry_adcreative_id = '3336453253'
# 广告组ID
ry_adgroup_id = '33387645342536'
# 广告计划ID
ry_adplan_id = '333543213423'
# 广告组名称
ry_adgroup_name = 'ry_adgroup_name'
# 广告计划名称
ry_adplan_name = 'ry_adplan_name'
# 广告创意名称
ry_adcreative_name = 'ry_adcreative_name'
# bytedance_int 今日头条,kuaishou_int 快手,tencentams_int (新)广点通,rryingxiao_int 人人营销
pid = 'rryingxiao_int'
# 精准
# NvqIJfa
# 模糊
# Af2qIfa
# 3aAnAfa
URL = 'http://10.2.20.42:8083/tkio/vEBV7ra?preorder=true&noredirect=true'
# URL = 'http://uri6.com/adapt/encryp/love.match.set-bytedance?noredirect=true&pid=rryingxiao_int&callback=D8311DBF28D751F327B83F7CEE5B8850B88CC74C8C3FF628EB3A48CAE2212EE260EE347E1771382C5F1B2C0FC9E8921CB5245576D7E5C1EF680315AAA98DCFB189F66FBA49CC7BCB8E4B4726D6D363B816BB2133CADC80B1C12D9FE464A05ED974A70A646BAB1D4D78E2A75361676D5A0D3D4E52B7E7C6B72E9388C17FE9384BE1A47503AABEFB9423727DBAC7B7275AAD237E0E2774D2A8C3D0FDC895CE10C0CCE38F8FEDBC24AF2E23B2B5E742B50C07744361334E148979087917DFFFC445A74B9F939412DEF8D060474E1D353ED7E2EB636B32CADF29842BB90E2131BD3ED05D1A0438EA0EA8577613780B3D64377D85E758A2B20507A034A2C8A96077C7E200C410188C78F76B9B5E7F3E5E4AC3'
# URL = 'http://10.2.20.42:8083/tkio/encryp/uENNrya?noredirect=true&callback=D8311DBF28D751F327B83F7CEE5B885033E9390C927C9AD11DC560E284B8264F60EE347E1771382C5F1B2C0FC9E8921C232AEE9605803A05F03F2A37DB5C2A0434FE8EE58085C8DDC10A4729E93BB9141C43D64DC2E32BEC4D1B48617B15534E53B56C07040DD7816303D25B54BD99B71B7AC9BB6E733CC072F5E0D45835629E8EFE86BB75F2BE5F492CFC06DA04724949E0A13E33C6D8C40DEE1DC9555FA7477E02BB73108BFA234880D3CD8D7697FA7E1B63FE21DE5A9ACA0FB3D40AC484521879464AE0DC1C68B8D7FFE3092368685569A64D495EF6BB5C5A3388F0717412AE787A124F4643FD29A3789413FB6A09010841EA49F0C7D7606A56DF28BE20C6FA34BAEC6B57024C66B5322DF24281FA'
# ?impression=true
# ?noredirect=true
# ?preorder=true
# 234565656
# 16dc0cb882d3dbec4f7f66251a84d6dd
# 7e3aa681f68435b3f74de790d6424690
# 4eab4be709defbfc2cc85826b09caea0
# 6ba2b016f280004d10a1a354e426eceb
appkey = '16dc0cb882d3dbec4f7f66251a84d6dd'
event = 'event_1'
lst = []
nowTime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
s = 0
w = 0
# print("开始时间"+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
# 随机生成12为数组
i = ''.join(str(random.choice(range(10))) for _ in range(12))
# i = '862918037762069'
o = ''.join(str(random.choice(range(10))) for _ in range(12))
m = ''.join(str(random.choice(range(10))) for _ in range(12))
se = ''.join(str(random.choice(range(10))) for _ in range(12))
adid = ''.join(str(random.choice(range(10))) for _ in range(12))
# adid = '5011813780042235'
p1 = ''.join(str(random.choice(range(10))) for _ in range(12))
# p1 = '测试一下'
# "idfa": 'B5588C9C-4534-43FB-935D-F17C91622C83',
# "idfa": '00000000-0000-0000-0000-000000000000',
# sh1 = "track_click:"+appkey+":"+get_str_sha1_secret_str(i)
# print(sh1)
# i = '091508889907'
# md5加密
# 创建md5对象
# m = hashlib.md5()
# b = i.encode(encoding='utf-8')
# m.update(b)
# str_md5 = m.hexdigest().upper()
# print("md5加密:"+str_md5)
###########
# md16加密(截取md5加密的字符串)
# imei_16 = str_md5[8:24]
# print("md16加密:"+imei_16)
# 随机生成ip
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
# ip = '88.88.85.2'
parms = {
# 'androidid': i,
# 'imei': i,
# "idfa": '8C297900-EE26-4501-94B5-DDE6F83E1496',
# 'gxid': '78B5382F687FAD16E75F5DDDC7745013',
# 'caid': '00_A0FF634AEDF1403205A4A6A1118CDA61_A66338F33BEBB40F5CD65F198AF2F40C',
# 'oaid': '00000000000000000000000000000000',
'ip': ip,
}
def send_request(url):
response = requests.get(url=url, params=parms, timeout=5, verify=False)
print(response.text)
def send_request():
response = requests.get(url=URL, params=parms, timeout=5, verify=False)
print(response.text)
def test_ua():
# url = "http://10.2.20.42:8083/tkio/vEBV7ra?preorder=true&noredirect=true"
send_request()
def hcc():
print("hcc is shadan")
def hcc(c):
print(c)
# p = "hh"
hcc("mmmmhh")
print("1")
def zcc(p1,p2):
print("5")
return p1+p2
print("2")
def fanren():
print("4")
ww = zcc(1, 2)
print("6")
# print(ww)
print("3")
fanren()
print("7")
import requests
import json
import pytest
url = "http://tkiomicro-receive-788931749.cn-north-1.elb.amazonaws.com.cn/receive/tkiov2/sdk"
headers = {
'Content-Type': 'application/json'
}
data = [
{
"application_info": {
"appkey": "74b81be2432c029040e0b2bc375ce7fb",
"bundleid": "3423232",
"app_version": "1.9.0",
"channel_name": "HUAWEI"
},
"timestamp_info": {
"time_zone": "GMT+08",
"install_time": "1637823377000",
"current_event_time": "1637823377000",
"report_time": "1637823377000"
},
"collector_info": {
"integration_type": "sdk",
"collector_version": "1.8.4",
"retried_times": ""
},
"device_info": {
"ryid": "8e4888e488a40a17aed2f6752f51382a4eafc",
"device_id": "3DEA635F-B24F-434B-833F-4ED028FEAEEF",
"device_id_type": "oaid",
"device_id_md5": "8e488a40a17aed2f6752f51382a4eafc",
"device_id_md5_type": "oaid_md5",
"os": "ANDROID",
"os_version": "19",
"manufacturer": "HUAWEI",
"model": "Mate 40",
"ipv4": "",
"ipv6": "1.1.1",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36",
"att_status": "unknown",
"lat_status": "disable",
"oaid": "3DEA635F-B24F-434B-833F-4ED028FEAEEF",
"oaid_md5": "8e488a40a17aed2f6752f51382a4eafc",
"imei1": "8342732742383",
"imei1_md5": "8e488a40a17aed2f6752f51382a4eafc",
"imei2": "8342732742383",
"imei2_md5": "8e488a40a17aed2f6752f51382a4eafc",
"gaid": "B21C5EC5-9921-42FD-AAC5-07A0EB6CF1A0",
"gaid_md5": "8e488a40a17aed2f6752f51382a4eafc",
"mac": "23456787898767898",
"mac_md5": "24953067e92f5bdebc9fd56411fd38f3",
"android_id": "1a34fc556a43c453",
"android_id_md5": "8e488a40a17aed2f6752f51382a4eafc"
},
"event_info": {
"event_name": "install",
"event_type": "preset",
"event_data": {
"user_id": "guest123",
"register_type": "WeChat",
"login_type": "Wechat",
"order_id": "2341242342676398724",
"order_amount": "343432",
"currency_type": "CNY",
"purchase_type": "Alipay",
"ad_platform": "csj",
"placement_type": "interstitial",
"placement_id": "23425334",
"ad_price": "4.34",
"ad_price_currency_type": "CNY",
"is_rendered": "1"
},
"custom_params": {
"add_cart": "234234",
"sku": "234234",
"level_up": "234234",
"refund": "234234",
"refund_amount": "234234"
}
}
}
]
print("ee")
# 函数只有调用的时候才会执行
def send_request():
response = requests.request("POST", url, headers=headers, data=json.dumps(data))
print(response.text)
response = json.loads(response.text)
# 断言 如果返回结果状态 等于0 正常执行,否则抛出异常
# assert response["status"] == 0
a = response["status"]
s = str(a)
response["status"] = s
return response
# 测试用例的名字一定要明显知道是干啥的,或者就加上备注,不要test_case1 ,以后多了就不知道这函数是干啥的了
def test_case1():
data[0]["application_info"]["appkey"] = "ffff"
response = send_request()
a = 5
b = 6
c = a
a = b
b = c
print(a)
print(b)
# 这里可以针对返回结果做断言,需要根据实际情况修改
assert response["status"] == "101"
def test_case2():
data[0]["application_info"]["bundleid"] = "ffff"
# 如果不需要对返回结果做处理 不用 获取返回值
response = send_request()
assert response["status"] == "0"
......@@ -2,11 +2,11 @@ from xiaochengxu.xiaochenxu_script import allEvent
import socket
import struct
import random
appkey = '9a6442bafe808b253cfb9b381e1d74fb'
appkey = '9f6dfeed6a42210a781bafb7e62dc722'
#cid
cid = '17774'
cid = '11469'
#surl
surl = 'fQbAVja'
surl = 'Evmu6na'
for _ in range(1):
# 随机生成12为数组
i = ''.join(str(random.choice(range(10))) for _ in range(12))
......@@ -15,7 +15,7 @@ for _ in range(1):
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
#打开
# allEvent().openxiaochengxu(i,ip,cid,surl,appkey)
allEvent().openxiaochengxu(i,ip,cid,surl,appkey)
#pv
allEvent().pviaochengxu(i,ip,cid,surl,appkey)
#离开
......
......@@ -5,9 +5,11 @@ import random
headers = {'Content-Type': 'application/json'}
#测试环境
# URL = 'http://10.3.20.42:8080/receive/tkio/event'
URL = 'http://10.2.20.42:8080/receive/tkio/event'
# URL = 'http://10.2.20.42:8080/receive/tkio/'
#线上环境
URL = 'http://log.reyun.com/receive/tkio/event'
# URL = 'http://log.reyun.com/receive/tkio/event'
# URL = 'http://tlog.trackingio.com/receive/tkio/event'
#时间和日期
......@@ -32,21 +34,21 @@ class allEvent:
#打开小程序
def openxiaochengxu(self,i,IP,cid,surl,appid):
s = json.dumps({
"what":"launch",
"appid":appid,
"context":{
"_cid":cid,
"_ip":IP,
"_deviceid":'null',
"what": "launch",
"appid": appid,
"context": {
"_cid": cid,
"_ip": IP,
"_deviceid": 'null',
# "_openid":i,
"_campaignid":surl,
"_sceneid":"unknown",
"_apptype":"wx"
"_campaignid": surl,
"_sceneid": "unknown",
"_apptype": "wx"
},
"where":"launch",
"when":when,
"ds":ds,
"who":"lxx-test"
"where": "launch",
"when": when,
"ds": ds,
"who": "lxx-test"
})
p = requests.post(url=URL, data=s, headers=headers, timeout=5)
print(p.text)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment