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)
......
# from numpy import long
from numpy import long
from android_event.android_script import allEvent
import random
......@@ -7,32 +7,28 @@ import socket
import struct
import time
import datetime
#导入hashlib模块进行md5操作
# 导入hashlib模块进行md5操作
import hashlib
# from jiami.md5 import get_str_sha1_secret_str
#向短链发送点击数据
# 向短链发送点击数据
# 广告创意ID
ry_adcreative_id = '3336453253'
ry_adcreative_id = '333'
# 广告组ID
ry_adgroup_id = '33387645342536'
ry_adgroup_id = '333'
# 广告计划ID
ry_adplan_id = '333543213423'
ry_adplan_id = '333'
# 广告组名称
ry_adgroup_name = 'ry_adgroup_name'
ry_adgroup_name = '新版测试-广告组'
# 广告计划名称
ry_adplan_name = 'ry_adplan_name'
ry_adplan_name = '新版测试-计划'
# 广告创意名称
ry_adcreative_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://jisuredirect.sortda.com/tkio/zQFVfma?noredirect=true'
# 测试头条衍生事件回调时加上
# callback= http%3A%2F%2Fad.toutiao.com%2Ftrack%2Factivate%2F%3Fcallback%3DCKP4rs-Zn4QDEKiQ6teZn4QDGN6L8Y-h9Wcg3ovxj6H1ZyiE0PjgroSEAzAOOM_X-8IDQik0YWY1NzdlOC1lZmViLTRmZDEtYmZkZC00MzE1Zjc1MmJhMGF1NTQ5M0iA0pOtA1AAiAEAkAECmAEA%26os%3D0%26muid%3D
# 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
......@@ -43,32 +39,31 @@ URL = 'http://10.2.20.42:8083/tkio/vEBV7ra?preorder=true&noredirect=true'
# 7e3aa681f68435b3f74de790d6424690
# 4eab4be709defbfc2cc85826b09caea0
# 6ba2b016f280004d10a1a354e426eceb
appkey = '16dc0cb882d3dbec4f7f66251a84d6dd'
event = 'event_1'
appkey = '519dd48e4162eb4f059d8ff91c307477'
lst = []
nowTime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
s = 0
w = 0
for _ in range(2):
for index in range(1):
# print("开始时间"+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
#随机生成12为数组
# 随机生成12为数组
i = ''.join(str(random.choice(range(10))) for _ in range(12))
# i = '862918037762069'
# i = '65453434546345'
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))
accountid = ''.join(str(random.choice(range(10))) for _ in range(12))
# accountid = '032273574734'
# 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加密
# 创建md5对象
# m = hashlib.md5()
# b = i.encode(encoding='utf-8')
......@@ -76,28 +71,30 @@ for _ in range(2):
# str_md5 = m.hexdigest().upper()
# print("md5加密:"+str_md5)
###########
#md16加密(截取md5加密的字符串)
# md16加密(截取md5加密的字符串)
# imei_16 = str_md5[8:24]
# print("md16加密:"+imei_16)
#随机生成ip
# 随机生成ip
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
# ip = '88.88.85.2'
# ip = '156.119.456.199'
try:
parms = {
# 'androidid': i,
# 'imei': i,
# "idfa": '8C297900-EE26-4501-94B5-DDE6F83E1496',
# 'androidid': '',
'imei': i,
# 'campuuid': '@#¥%……&……%¥#@#¥%&……&*****',
# 'clickid': '测试测试',
# "idfa": '00000000-0000-0000-0000-000000000000',
# 'gxid': '78B5382F687FAD16E75F5DDDC7745013',
# 'caid': '00_A0FF634AEDF1403205A4A6A1118CDA61_A66338F33BEBB40F5CD65F198AF2F40C',
# 'oaid': '00000000000000000000000000000000',
# 'oaid': '',
# 'oaid_MD5': '9f89c84a559f573636a47ff8daed0d33',
'ip': ip,
# '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/40.0.2214.89 UCBrowser/11.4.5.937 Mobile Safari/537.36',
# 'pid': pid,
# 'vid': '7653236654354534rffdvdv!@#¥%@测试测试'
# 'cached_caid': '00_A2FF034AEDF1403205A4A6A1118CDA67_A66338F33BEBB40F5CD65F198AF2F44C',
# "idfv": 'CB389725-0029-4A35-8E38-D142F836B626',
# "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",
"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",
# 'creativeId':'21321321312123',
# 'requestId':'312321321312',
# 'adId': long('21231'),
......@@ -111,7 +108,7 @@ for _ in range(2):
# 'meid': i
# 'bd_vid': i
# 'oaid': "9f80c84a559f573636a47ff8daed0d32",
# 'muid': "00000000-0000-0000-0000-000000000000",
# 'muid': "4C63905D9694B9BF8D3EE38E64809A73",
# 'mac': "5432453241421",
# 'subchannel': '333',
# 'aid': '111',
......@@ -141,17 +138,15 @@ for _ in range(2):
# '_carrier': '1',
# 'syscountryc': '1',
# 'sysrtime': '1',
# "accountid": '990099'
# "accountid": accountid
}
time.sleep(5)
#timeout可以超时四秒
# timeout可以超时四秒
# verify = False
p = requests.get(url=URL, params=parms, timeout=5, verify=False)
# p = requests.post(url=URL, params=parms, timeout=30, verify= False)
p = requests.get(url=URL, params=parms, timeout=10, verify=False)
print('imei:', i)
print("ip:", ip)
# print(p.text)
# print("accountid:", accountid)
print(p.text)
print(p.url)
# print("oaid:",o)
print('success:', s)
......@@ -159,29 +154,59 @@ for _ in range(2):
print(p.content)
# print('androidid:',a)
# print(nowTime)
s = s+1
s = s + 1
except Exception as err:
print(err)
print('wrong:', w)
print('imei:', i)
print("ip:", ip)
# print(p.status_code)
#print('androidid', a)
w = w+1
# time.sleep(10)
# print('androidid', a)
w = w + 1
time.sleep(8)
try:
allEvent().installUpload(i, ip, appkey)
# allEvent().formevent(i, ip, appkey)
except Exception:
print('install_wrong:', w)
w = w + 1
# time.sleep(5)
# try:
# allEvent().installUpload(i, ip, appkey)
# # allEvent().formevent(i, ip, appkey)
#
# 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('install_wrong:', w)
# w = w + 1
# print('登录_wrong:', w)
# time.sleep(5)
# try:
# allEvent().payEvent(i, ip, appkey)
# except Exception as err:
# print(err)
# print('付费_wrong:', w)
# time.sleep(3)
# try:
# allEvent().retentionEvent(i,ip,appkey)
# allEvent().payorder(i, ip, appkey)
# except Exception:
# print('订单_wrong:', w)
# try:
# allEvent().invoke_test(i, ip, appkey)
# except Exception:
# print('retention',w)
# print('install_wrong:', w)
# w = w + 1
# # time.sleep(3)
# # try:
# # allEvent().retentionEvent(i,ip,appkey)
# # except Exception:
# # print('retention',w)
# # w = w + 1
# time.sleep(3)
# try:
# allEvent().adshow(i, ip, appkey,adid)
......@@ -218,42 +243,70 @@ for _ in range(2):
# except Exception:
# print('install_wrong:', w)
# w = w + 1
# num = index + 1
# event = 'event_' + str(num)
# event = 'event_17'
# time.sleep(3)
# try:
# allEvent().ziding_event(i, ip, appkey, event)
# print(event)
# except Exception as err:
# print(err)
# print('自定义_wrong:', w)
# time.sleep(6)
# try:
# allEvent().H5pv(i, ip, appkey)
# 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)
# allEvent().H5download(i, ip, appkey)
# except Exception:
# print('install_wrong:', w)
# w = w + 1
# time.sleep(5)
# try:
# allEvent().loginEvent(i, ip, appkey)
# allEvent().h5registerEvent(i, ip, appkey)
# except Exception:
# print('登录_wrong:', w)
# print('install_wrong:', w)
# w = w + 1
# time.sleep(5)
# try:
# allEvent().ziding_event(i, ip, appkey, event)
# except Exception as err:
# print(err)
# print('自定义_wrong:', w)
# # #
# time.sleep(2)
# allEvent().h5loginEvent(i, ip, appkey)
# except Exception:
# print('install_wrong:', w)
# w = w + 1
#
# time.sleep(5)
# try:
# allEvent().payEvent(i, ip, appkey)
# except Exception as err:
# print(err)
# print('付费_wrong:', w)
# time.sleep(3)
# allEvent().h5payEvent(i, ip, appkey)
# except Exception:
# print('install_wrong:', w)
# w = w + 1
# time.sleep(5)
# try:
# allEvent().payorder(i, ip, appkey)
# allEvent().h5payorder(i, ip, appkey)
#
# except Exception:
# print('订单_wrong:', w)
# print('install_wrong:', w)
# w = w + 1
# print("结束时间" + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
#
#
#
# lst.append(i)
# print(lst)
......@@ -3,43 +3,41 @@ import json
import time
import random
headers = {'Content-Type': 'application/json', 'X-RY-Access-Token': 'test_access_token'}
headers = {'Content-Type': 'application/json'}
# X-RY-Access-Token': 'b8f6d4c7b8a848e697291dccf9027120
#测试环境
# URL_batch = 'http://10.3.20.42:8080/receive/batch'
# 测试环境
URL_batch = 'http://10.3.20.42:8080/receive/batch'
# URL = 'http://10.2.20.42:8080/receive/tkio/'
URL = 'http://log.trackingio.com/receive/tkio/'
# URL = 'http://log.trackingio.com/receive/tkio/'
URL = 'http://jisulog.sortda.com/receive/tkio/'
# URL = 'http://172.31.21.207:8080/receive/tkio/'
# URL = 'http://120.53.212.71/receive/tkio/'
# 腾迅云tkio http协议的生产地址:
# URL = 'http://tlog.trackingio.com/receive/tkio/'
#时间戳
# 时间戳
current_time_13 = int(round(time.time() * 1000))
#时间和日期
# 时间和日期
when = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
#日期
# 日期
ds = time.strftime('%Y-%m-%d', time.localtime(time.time()))
#设备品牌
# 设备品牌
manufacturer = 'vivo'
#设备系统
ryos = 'ios'
#设备类型
# 设备系统
ryos = 'android'
# 设备类型
rydevicetype = 'vivox9'
#网络类型
network ='wifi'
#分辨率
resolution ='1344*750'
#运行商
op='中国移动'
# 网络类型
network = 'wifi'
# 分辨率
resolution = '1344*750'
# 运行商
op = '中国移动'
# 支付类型 支付宝(alipay),银联(unionpay),微信支付(weixinpay),易宝支付(yeepay)
paymenttype = 'alipay'
#货币类型
# 货币类型
currencytype = 'CNY'
#支付的货币金额
# 支付的货币金额
currencyamount = '90'
# # 填充广告在变现平台的广告位ID
# adid = '839296815'
......@@ -70,21 +68,24 @@ class allEvent:
s = json.dumps({
# "what":'install',
"appid": appkey,
# "appType": "wap",
"context": {
# "_apptype": "wap",
"_carrier": carrier,
"_networkwhat_type": network_type,
"_ryosversion": ryosversion,
"_model": model,
"_pkgname": "com.yanjing.yami",
"_campaignid": 'default',
# "_campaignid": 'default',
"_deviceid": i,
"_imei": i,
'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/40.0.2214.89 UCBrowser/11.4.5.937 Mobile Safari/537.36',
# '_oaid': '875643256870978657463524',
# '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/40.0.2214.89 UCBrowser/11.4.5.937 Mobile Safari/537.36',
# "idfa": i,
# "_current_caid": "00_A0FF634AEDF1403205A4A6A1118CDA61_A66338F33BEBB40F5CD65F198AF2F40C",
# "gxid": "876543567543565",
# "_idfv": i,
"_androidid": '1987654567898765',
# "_androidid": i,
# "_imei2":"324323AAAA",
# "_meid": "CCC324323",
"_ip": IP,
......@@ -96,11 +97,12 @@ class allEvent:
'_resolution': resolution,
'_op': op,
'_timestamp': current_time_13,
# '_oaid': '9f80c84a559f573636a47ff8daed0d32',
'_mac': "5432453241421",
"_istablet": istablet,
"_lib" : lib,
"_lib_version": lv,
"_lib": lib,
"_lib_version": lv
# "verify": "{\"result\":\"{\"errorMsg\":\"实名认证失败\"}\"}"
,
# 'sysfsize': '111',
# '_model': '1',
......@@ -112,48 +114,9 @@ class allEvent:
# 'syscountryc': '1',
# 'sysrtime': '1',
# 转化类型,新增或重装,Download 或 Redownload
# "iad-conversion-type": "Redownload",
# # 关键词 id
# "iad-keyword-id": "12323222",
# # 点击ASA广告时间
# "iad-click-date": when,
# # 素材ID
# "iad-creativeset-id": "1234567890",
# # 广告组名称
# "iad-adgroup-name": "AdGroupName",
# # 广告活动ID
# "iad-campaign-id": "1234567890",
# # 本次下载完成的时间(仅ASA转化时,该值传且必传)
# "iad-conversion-date": "2021-06-24T11:22:23Z",
# # 关键词匹配类型
# "iad-keyword-matchtype": "Broad",
# #首次下载完成的时间(有可能包括非ASA转化,当为redownload且conversion date有值时,purchase date是第一次下载App的时间)
# "iad-purchase-date": "2021-06-24T11:22:23Z",
# # 归因结果
# "iad-attribution": "true",
# # 广告活动组ID(campaign group id)
# "iad-org-id": "1234567890",
# # 关键词
# "iad-keyword": "Keyword",
# # 素材名称
# "iad-creativeset-name": "CreativeSetName",
# # 国家
# "iad-country-or-region": "US",
# # 广告活动名称
# "iad-campaign-name": "CampaignName",
# # 广告组ID
# "iad-adgroup-id": "1234567890",
# # 广告活动组名称(campaign group name)
# "iad-org-name": "OrgName",
# "iad-lineitem-id": "1234567890",
# "iad-lineitem-name": "LineName",
# "asatoken": "PLEU97c4CmufaE1LSl1WtLiJYp/uAzaw2/u1ClT+/3oOXTZioJj7HQIYfPwXFWajiQSKEQKrVPsMnWQehYxKvM738taR5TvFewAAAVADAAAAywAAAIB8/odC2bsr2fCP0zyFh2a48uyqcqFV3Wn0H+OnHN503dkHiCpsUaiHAptHQ/rAZgwXbtOXr4614Qabc0C6/55eP4mcFycPe24Q6rnkFl5ShwZmeEvu7I/oDWoDFkVKu0zD1g5dI6+yBI6Eb/Jj64OUAv6vpadD2SjJmqyBKHzhoAAAAB+I7jKYVGw7cbkI3+pjVhmfRPcq/WqGUP/FQhenKvuzAAAAnwGApEjvnfSmSwNz08eBOarI6h0R/AAAAIYEBDPzgQTIVpZBqceNqDtPiNNg0gYO9zXPdYKgB+aWtBsu5f6dUTZ/cA0Q2igUO7WpNTVOLT8HiA9GwulZtKM87LwOoD/p4Km9wFfsbZgxSnt6sgYGCfFY4GehIKqsNeuCUS+9M4/Z2LRIcWEXkbhm/AE1XsmemM5JjB8P8+wGe0Mb5Xb1XQABBEUNAAA=",
# "asatoken": "PLEU97c4CmufaE1LSl1WtLiJYp/uAzaw2/u1ClT+/3oOXTZioJj7HQIYfPwXFWajiQSKEQKrVPsMnWQehYxKvM738taR5TvFewAAAVADAAAAywAAAIB8/odC2bsr2fCP0zyFh2a48uyqcqFV3Wn0H+OnHN503dkHiCpsUaiHAptHQ/rAZgwXbtOXr4614Qabc0C6/55eP4mcFycPe24Q6rnkFl5ShwZmeEvu7I/oDWoDFkVKu0zD1g5dI6+yBI6Eb/Jj64OUAv6vpadD2SjJmqyBKHzhoAAAAB+I7jKYVGw7cbkI3+pjVhmfRPcq/WqGUP/FQhenKvuzAAAAnwGApEjvnfSmSwNz08eBOarI6h0R/AAAAIYEBDPzgQTIVpZBqceNqDtPiNNg0gYO9zXPdYKgB+aWtBsu5f6dUTZ/cA0Q2igUO7WpNTVOLT8HiA9GwulZtKM87LwOoD/p4Km9wFfsbZgxSnt6sgYGCfFY4GehIKqsNeuCUS+9M4/Z2LRIcWEXkbhm/AE1XsmemM5JjB8P8+wGe0Mb5Xb1XQABBEUNAAA=",
# "_oaid_limited": "false",
# "_app_version": "1.2.0_1565149_1627898",
......@@ -193,24 +156,23 @@ class allEvent:
# "_network_type": "UNKOWN",
# "_deviceid": "5C70287B-27F5-4AC3-9E9C-2D67B8CF1065"
},
# 'when': '2021-01-17 23:59:36',
#time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
'when': '2021-01-17 23:59:36',
# time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
# 'ds': ds,
'who': 'lxx_test'
})
try:
p = requests.post(url=URL+'install', data=s, headers=headers, timeout=5)
p = requests.post(url=URL + 'install', data=s, headers=headers, timeout=5)
# , headers = headers
print("激活:" + p.text)
print("设备id:"+i)
print("设备id:" + i)
print(p.url)
except Exception as err:
print(err)
#今日头条归因
# 今日头条归因
def formevent(self, i, IP, appkey):
s = json.dumps({
"appid": appkey,
......@@ -238,11 +200,11 @@ class allEvent:
'who': 'lxx_test'
})
p = requests.post(url=URL+'form', data=s, headers=headers, timeout=10)
p = requests.post(url=URL + 'form', data=s, headers=headers, timeout=10)
print("今日头条表单" + p.text)
# 启动
def startupEvent(self, i, IP, appkey):
s = json.dumps(
{
......@@ -284,7 +246,6 @@ class allEvent:
'syscountryc': '1',
'sysrtime': '1',
},
# 'when': when,
# 'ds': ds,
......@@ -292,23 +253,24 @@ class allEvent:
}
)
p = requests.post(url=URL+'startup', data=s, headers=headers, timeout=10)
print("启动"+p.text)
p = requests.post(url=URL + 'startup', data=s, headers=headers, timeout=10)
print("启动" + p.text)
print(when)
#注册
def registerEvent(self,i,IP,appkey):
# 注册
def registerEvent(self, i, IP, appkey):
s = json.dumps({
# 'what':'register',
'appid':appkey,
'context':{
'_deviceid':i,
'_imei':i,
# 标识是否是h5字段
# "appType": "wap",
'appid': appkey,
'context': {
# "_apptype": "wap",
'_deviceid': i,
'_imei': i,
# "_idfv": i,
# '_androidid':i,
'_ip':IP,
'_ip': IP,
'_timestamp': current_time_13,
'_oaid': i,
"_lib_version": lv,
......@@ -318,17 +280,18 @@ class allEvent:
# 'ds': ds,
'who': 'lxx_test'
})
p = requests.post(url=URL+'register',data=s,headers=headers,timeout=10)
#print("注册时间戳"+current_time_13)
print("注册"+p.text)
p = requests.post(url=URL + 'register', data=s, headers=headers, timeout=10)
# print("注册时间戳"+current_time_13)
print("注册" + p.text)
#登陆
def loginEvent(self,i,IP,appkey):
# 登陆
def loginEvent(self, i, IP, appkey):
s = json.dumps({
# 'what': 'loggedin',
'appid': appkey,
# "appType": "wap",
'context': {
# "_apptype": "wap",
'_deviceid': i,
# '_imei': i,
"_idfv": i,
......@@ -346,16 +309,15 @@ class allEvent:
'who': 'lxx_test'
})
try:
p = requests.post(url=URL+'loggedin', data=s, headers=headers, timeout=10)
print("登录"+p.text)
p = requests.post(url=URL + 'loggedin', data=s, headers=headers, timeout=10)
print("登录" + p.text)
except Exception as err:
print(err)
# 付费
#付费
def payEvent(self,i,IP,appkey):
#订单号
def payEvent(self, i, IP, appkey):
# 订单号
transactionid = ''.join(str(random.choice(range(10))) for _ in range(19))
s = json.dumps({
'what': 'payment',
......@@ -370,21 +332,22 @@ class allEvent:
'_paymenttype': paymenttype,
'_ryos': ryos,
'_currencytype': currencytype,
'_currencyamount':currencyamount,
'_currencyamount': currencyamount,
"_lib_version": lv,
'_oaid':"unknow"
'_oaid': "unknow"
},
# 'when': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())),
# 'ds': ds,
'who': 'lxx_test'
})
p = requests.post(url=URL+'payment', data=s, headers=headers, timeout=5)
print("付费"+p.text)
p = requests.post(url=URL + 'payment', data=s, headers=headers, timeout=5)
print("付费" + p.text)
# print(str(s))
# 订单
def payorder (self, i, IP, appkey):
def payorder(self, i, IP, appkey):
# 订单号
transactionid = ''.join(str(random.choice(range(10))) for _ in range(19))
s = json.dumps({
......@@ -408,35 +371,45 @@ class allEvent:
# 'ds': ds,
'who': 'lxx_test'
})
p = requests.post(url=URL+'event', data=s, headers=headers, timeout=5)
print("订单"+p.text)
p = requests.post(url=URL + 'event', data=s, headers=headers, timeout=5)
print("订单" + p.text)
#自定义事件
def ziding_event(self,i,IP,appkey,event):
# 自定义事件
def ziding_event(self, i, IP, appkey, event):
s = json.dumps({
'what': event,
# h5
# "appType": "wap",
# 微信
# "appType": "wx",
'appid': appkey,
'context': {
# "_apptype": "wx",
'_deviceid': i,
'_imei': i,
'_androidid': i,
'_ip': IP,
'_ryos': ryos,
"_lib_version": lv,
'_key_action_category': '1', '_key_action_threshold': '15',
#识别是否为自定义事件,默认传1
'_isreyundefaultevent':'1'
'_key_action_category': '1',
'_key_action_threshold': '15',
# 识别是否为自定义事件,默认传1
'_isreyundefaultevent': '1',
# 'who': 'lxxtest',
's': '0',
'e': '1',
'm': '2',
},
# 'when': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())),
# 'ds': ds,
'who': 'lxx_test'
})
p = requests.post(url=URL+'event', data=s, headers=headers, timeout=5)
print("自定义"+p.text)
p = requests.post(url=URL + 'event', data=s, headers=headers, timeout=5)
print("自定义" + p.text)
# 自定义事件
def invoke_test(self, i, IP, appkey):
s = json.dumps({
"what": "invoke",
......@@ -459,7 +432,7 @@ class allEvent:
# "_idfa": "DBC43622-E34B-440C-B7A7-FB6641D0D9AB",
"_idfv": i,
"_lib_version": lv,
"_carrier":carrier,
"_carrier": carrier,
"_ry_ts": "1565941809416",
"_create_timestamp": "1565941809351",
"_tz": "+8",
......@@ -481,11 +454,12 @@ class allEvent:
# "ds": ds,
"who": "unknown"
})
p = requests.post(url=URL+'event', data=s, headers=headers, timeout=5)
p = requests.post(url=URL + 'event', data=s, headers=headers, timeout=5)
print("自定义" + p.text)
# 广告展示
def adshow(self, i, IP, appkey,adid):
def adshow(self, i, IP, appkey, adid):
s = json.dumps({
"appid": appkey,
"context": {
......@@ -523,9 +497,8 @@ class allEvent:
except Exception as err:
print(err)
# 广告点击
def adclick(self, i, IP, appkey,adid):
def adclick(self, i, IP, appkey, adid):
s = json.dumps({
"appid": appkey,
"context": {
......@@ -615,12 +588,9 @@ class allEvent:
print("retention" + p.text)
print(when)
# App页面浏览时长分布
def pageduration(self, i, IP, appkey,sessionID,pageId):
def pageduration(self, i, IP, appkey, sessionID, pageId):
s = json.dumps({
"appid": appkey,
"context": {
......@@ -657,14 +627,8 @@ class allEvent:
except Exception as err:
print(err)
# App使用时长
def appduration(self, i, IP, appkey,sessionID):
def appduration(self, i, IP, appkey, sessionID):
s = json.dumps({
"appid": appkey,
"context": {
......@@ -699,7 +663,8 @@ class allEvent:
print("App使用时长:" + p.text)
except Exception as err:
print(err)
# 批量上传数据接口
# 批量上传数据接口
def batchUpload(self, i, IP, appkey):
s = json.dumps(
{"from": "tkio", "data": [
......@@ -730,22 +695,19 @@ class allEvent:
# h5
def H5(self, i, IP, appkey):
# h5下载
def H5download(self, i, IP, appkey):
s = json.dumps({
"what": "download",
"appType": "wap",
"appid": appkey,
"context": {
"_campaignid": "_default_",
# "_campaignid": "_default_",
"_deviceid": i,
"_cid": "-1",
"_ry_ts": "1588130655311",
# "_cid": "-1",
# "_ry_ts": "1588130655311",
"_tz": "+8",
"_ip":IP,
"_ip": IP,
"_apptype": "wap",
"_campaignid_bak": "_default_",
"_ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36",
......@@ -756,9 +718,197 @@ class allEvent:
"when": when,
"ds": ds,
"who": "552317006484"
})
})
try:
p = requests.post(url=URL + 'event', data=s, headers=headers, timeout=5)
print("App使用时长:" + p.text)
print("download:" + p.text)
except Exception as err:
print(err)
# h5pv
def H5pv(self, i, IP, appkey):
s = json.dumps({
"what": "pageview",
"appType": "wap",
"appid": appkey,
"context": {
# "_campaignid": "_default_",
"_deviceid": i,
# "_cid": "-1",
# "_ry_ts": "1588130655311",
"_tz": "+8",
"_ip": IP,
"_apptype": "wap",
# "_campaignid_bak": "_default_",
"_ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36",
# "_cid_bak": "-1"
},
"where": "event",
"deviceid": i,
"when": when,
"ds": ds,
"who": "552317006484"
})
try:
p = requests.post(url=URL + 'event', data=s, headers=headers, timeout=5)
print("pv:" + p.text)
except Exception as err:
print(err)
#h5 注册
def h5registerEvent(self, i, IP, appkey):
s = json.dumps({
# 'what':'register',
# 标识是否是h5字段
"appType": "wap",
'appid': appkey,
'context': {
"_apptype": "wap",
'_deviceid': i,
'_imei': i,
# "_idfv": i,
# '_androidid':i,
'_ip': IP,
'_timestamp': current_time_13,
'_oaid': i,
"_lib_version": lv,
},
# 'when': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())),
# 'ds': ds,
'who': 'lxx_test'
})
p = requests.post(url=URL + 'register', data=s, headers=headers, timeout=10)
# print("注册时间戳"+current_time_13)
print("注册" + p.text)
# 登陆
def h5loginEvent(self, i, IP, appkey):
s = json.dumps({
# 'what': 'loggedin',
'appid': appkey,
"appType": "wap",
'context': {
"_apptype": "wap",
'_deviceid': i,
# '_imei': i,
"_idfv": i,
'_androidid': i,
'_ip': IP,
'_ryos': ryos,
"_lib_version": lv,
"serverid": "111111",
# '_rydevicetype': rydevicetype,
'_timestamp': current_time_13
},
# 'when': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())),
# 'ds': ds,
'who': 'lxx_test'
})
try:
p = requests.post(url=URL + 'loggedin', data=s, headers=headers, timeout=10)
print("登录" + p.text)
except Exception as err:
print(err)
# 付费
def h5payEvent(self, i, IP, appkey):
# 订单号
transactionid = ''.join(str(random.choice(range(10))) for _ in range(19))
s = json.dumps({
'what': 'payment',
'appid': appkey,
"appType": "wap",
'context': {
"_apptype": "wap",
'_deviceid': i,
'_imei': i,
'_androidid': i,
'_ip': IP,
'_timestamp': current_time_13,
'_transactionid': transactionid,
'_paymenttype': paymenttype,
'_ryos': ryos,
'_currencytype': currencytype,
'_currencyamount': currencyamount,
"_lib_version": lv,
'_oaid': "unknow"
},
# 'when': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())),
# 'ds': ds,
'who': 'lxx_test'
})
p = requests.post(url=URL + 'payment', data=s, headers=headers, timeout=5)
print("付费" + p.text)
# print(str(s))
# 订单
def h5payorder(self, i, IP, appkey):
# 订单号
transactionid = ''.join(str(random.choice(range(10))) for _ in range(19))
s = json.dumps({
'what': 'order',
'appid': appkey,
"appType": "wap",
'context': {
"_apptype": "wap",
'_deviceid': i,
'_imei': i,
'_androidid': i,
'_ip': IP,
'_timestamp': current_time_13,
'_transactionid': transactionid,
'_paymenttype': paymenttype,
"_lib_version": lv,
'_currencytype': currencytype,
'_ryos': ryos,
'_currencyamount': currencyamount,
},
# 'when': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())),
# 'ds': ds,
'who': 'lxx_test'
})
p = requests.post(url=URL + 'event', data=s, headers=headers, timeout=5)
print("订单" + p.text)
# h5
def H5su(self, i, IP, appkey):
s = json.dumps({
"what": "startup",
"appType": "wap",
"appid": appkey,
"context": {
# "_campaignid": "_default_",
"_deviceid": i,
# "_cid": "-1",
# "_ry_ts": "1588130655311",
"_tz": "+8",
"_ip": IP,
"_apptype": "wap",
# "_campaignid_bak": "_default_",
"_ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36",
# "_cid_bak": "-1"
},
"where": "event",
"deviceid": i,
"when": when,
"ds": ds,
"who": "552317006484"
})
try:
p = requests.post(url=URL + 'event', data=s, headers=headers, timeout=5)
print("pv:" + p.text)
except Exception as err:
print(err)
\ No newline at end of file
......@@ -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)
......
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 = '111111'
# 广告组ID
ry_adgroup_id = '111111'
# 广告计划ID
ry_adplan_id = '111111'
# 广告组名称
ry_adgroup_name = '新版测试-广告组'
# 广告计划名称
ry_adplan_name = '新版测试-计划'
# 广告创意名称
ry_adcreative_name = '新版测试创意'
# bytedance_int 今日头条,kuaishou_int 快手,tencentams_int (新)广点通,rryingxiao_int 人人营销
pid = 'rryingxiao_int'
# url = 'http://10.2.20.42:8083/tkio/6vIjq2a?noredirect=true&impression=true'
# impression=true
i = ''.join(str(random.choice(range(10))) for _ in range(12))
# i = '938306982724'
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))
accountid = ''.join(str(random.choice(range(10))) for _ in range(12))
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
parms = {
# 'androidid': '76543242422323',
'imei': i,
# "idfa": '457860D4-68DA-675E-BAFD-D3ECEBBCAU56',
# 'gxid': '78B5382F687FAD16E75F5DDDC7745013',
# 'caid': '00_A0FF634AEDF1403205A4A6A1118CDA61_A66338F33BEBB40F5CD65F198AF2F40C',
# 'oaid': '875643256870978657463524',
# 'oaid_MD5': '9f89c84a559f573636a47ff8daed0d33',
'ip': ip,
# 'pid': pid,
# 'vid': '7653236654354534rffdvdv!@#¥%@测试测试'
# 'cached_caid': '00_A2FF034AEDF1403205A4A6A1118CDA67_A66338F33BEBB40F5CD65F198AF2F44C',
# "idfv": 'CB389725-0029-4A35-8E38-D142F836B626',
"ua": "/5.0 (Windows NT 6.1; Win64; x64; rv:47.0)MozillaiOS Gecko/20100101 Firefox/47.0",
# '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,
# 'imei2': 'null',
# "accountid": accountid
}
def send_requestandroid(url,duanlian):
# url1 = 'http://10.2.20.42:8083/tkio/' + duanlian +'?noredirect=true' + url
url1 = 'https://uri6.com/tkio/' + duanlian +'?noredirect=true' + url
response = requests.get(url=url1, params=parms, timeout=10, verify=False)
print(response.text)
print(i)
print(url1)
return response
class TestClass:
# 空ua
def test_ua(self):
parms["ua"] = ''
duanlian = 'zE3ayua'
url = ""
send_requestandroid(url, duanlian)
#ua里含有Android,安卓点击
def test_uaandroid(self):
parms["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'
url = ""
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
#ua里含有iOS,安卓点击
def test_uaios(self):
parms["ua"] = 'Mozilla/5.0 (Linux; U; iOS 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'
url = ''
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
#安卓含有idfa,信息不一致点击,安卓点击
def test_uaidfa(self):
parms["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'
parms["idfa"] = "457068D4-68DA-675E-BAFD-D3ECEBBCAU56"
url = ''
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
# 空ua,安卓点击
def test_invalid_ua(self):
parms["ua"] = '23231231'
url = ''
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
# 非法字符点击,安卓点击
def test_invaild_parameters(self):
parms["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'
url = ''
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
# 广协IP黑名单点击,安卓点击
def test_caa_blacklist_ip(self):
parms["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'
url = ''
duanlian = 'zE3ayua'
parms["ip"] = '103.235.232.140'
send_requestandroid(url, duanlian)
# 爬虫UA点击,安卓点击
def test_crawler(self):
parms["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.36ahrefsbot'
url = ''
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
# 高危作弊来源,安卓点击
def test_crawler(self):
parms["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'
url = ''
duanlian = 'ziUB7fa'
send_requestandroid(url, duanlian)
# 空ua,安卓展示
def test_uaimp(self):
parms["ua"] = ''
url = "&impression=true"
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
#ua里含有Android,安卓展示
def test_uaandroidimp(self):
parms["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'
url = "&impression=true"
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
#ua里含有iOS,安卓展示
def test_uaios(self):
parms["ua"] = 'Mozilla/5.0 (Linux; U; iOS 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'
url = "&impression=true"
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
#安卓含有idfa,信息不一致点击,安卓展示
def test_uaidfaimp(self):
parms["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'
parms["idfa"] = "457068D4-68DA-675E-BAFD-D3ECEBBCAU56"
url = "&impression=true"
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
# 空ua,安卓展示
def test_invalid_uaimp(self):
parms["ua"] = '23231231'
url = "&impression=true"
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
# 非法字符点击,安卓展示
def test_invaild_parametersimp(self):
parms["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'
url = "&impression=true"
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
# 广协IP黑名单点击,安卓展示
def test_caa_blacklist_ipimp(self):
parms["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'
parms["ip"] = '103.235.232.140'
url = "&impression=true"
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
# 爬虫UA点击,安卓展示
def test_crawlerimp(self):
parms["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.36ahrefsbot'
url = "&impression=true"
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
# 高危作弊来源,安卓展示
def test_crawlerimp(self):
parms["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'
url = "&impression=true"
duanlian = 'ziUB7fa'
send_requestandroid(url, duanlian)
#ip非法字符点击,安卓点击
def test_ip1(self):
parms["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'
url = ''
lis = ['!', '@', '¥', '#', '*', '?','[',']','<','>']
for zi in lis:
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
parms["ip"] = ip+zi
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
#ip非法字符点击,安卓展示
def test_ip2(self):
parms["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'
url = "&impression=true"
lis = ['!', '@', '¥', '#', '*', '?', '[', ']', '<', '>']
for zi in lis:
ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
parms["ip"] = ip+zi
duanlian = 'zE3ayua'
send_requestandroid(url, duanlian)
\ No newline at end of file
......@@ -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'
zf128 = 'xiaomi小米小米xiaomi小米小米xiaomi小米小米xiaomi小米小米xiaomi小米小米小米xiaomi小米xiaomi小米xiaomi小米xiaomi小米xiaomi小米xiao'
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'
zf256 = '测试广告组名称,广告计划名称,广告创意名称,渠道回调id,渠道回调地址等于256字符广告组名称,广告计划名称,广告创意名称,渠道回调id,渠道回调地址等于256字符广告组名称,广告计划名称,广告创意名称,渠道回调id,渠道回调地址等于256字符广告组名称,广告计划名称fff'
global parms
parms = {
# 触点传参时间。is_s2s=1时必传,0时选传。不同渠道有可能传多种格式,详见需求。限制32位字符内。短链传参。
'ts': '2122132121',
# 集成方式。is_s2s=1为服务器上报触点,0为客户端上报触点。0或1时有不同的参数非空校验,详见需求。固定为0或1。都必传
'is_s2s': '1',
# 操作系统。限制16字符内。都选传。短链传参。暂不与app_platform互相做校验。
'os': 'ios',
# 设备型号。限制64字符内。都选传。短链传参。
'model': '小米',
# 用户公网IP v4版本。限制15字符内。is_s2s=1时都必传,0时都选传,0时优先取传参IP,未传参或传参报错时,取http header中的ip作为ipv4的值
'ipv4': '1.1.1.1',
# 用户公网IP v6版本。限制128字符内。都选传
'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',
# 触点类型。固定为click。都必传
'touchpoint_type': 'click',
# 归因类型。固定为ua(user acquirement新客获取)
'attribution_type': 'ua',
# 广告账户id。限制64字符内。都选传
'account_id': '',
# 广告组id。限制64字符内。都选传
'adgroup_id': '',
# 广告组名称。限制256字符内。都选传
'adgroup_name': '',
# 广告计划id。限制64字符内。都选传
'adplan_id': '',
# 广告计划名称。限制256字符内。都选传
'adplan_name': '',
# 广告创意id。限制128字符内。都选传
'adcreative_id': '',
# 广告创意名称。限制256字符内。都选传
'adcreative_name': '',
# 创意类型(例如大图、小图、视频等)。限制16字符内。都选传
'adcreative_type': '',
# 流量媒体id(例如巨量的今日头条、穿山甲、抖音等)。限制32字符内。都选传
'site_id': '',
# 流量媒体名称(例如巨量的今日头条、穿山甲、抖音等)。限制128字符内。都选传
'site_name': '',
# 广告类型(例如开屏、信息流、搜索等)。限制32字符内。都选传。
'ad_type': '',
# 广告位id。限制64字符内。都选传
'placement_id': '',
# 转化id。限制64字符内。都选传
'conversion_id': '',
# 广告点击id。限制64字符内。都选传
'click_id': '',
# 广告展示id。限制64字符内。都选传
'impression_id': '',
# 广告请求id。限制64字符内。都选传
'request_id': '',
# 渠道回调id。限制256字符。都选传
'callback_id': 'EJiw267wvfQCGKf2g74ZIPD89-vIATAMOAFCIjIwMTkxMTI3MTQxMTEzMDEwMDI2MDc3MjE1MTUwNTczNTBIAQ==',
# 渠道回调地址。限制256字符。都选传
'callback_url': 'http%3A%2F%2Ftracking.e.qq.com%2Fconv%3Fcb%3DMTIzYWJjNDU2ZGVm%26conv_id%3D12345678',
# 自定触点参数集合。都选传。
'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):
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 send_request2(dl, cs):
url1 = 'http://tmtest.trackingio.com/receive/turl/' + dl + cs
response = requests.get(url=url1, params=parms, timeout=10, verify=False)
print(response.url)
# response = json.loads(response.text)
return response
# 短链错误
def test_dl():
re = send_request('33322', '')
assert re["status"] == 166
# 触点传参时间为正常
def test_ts1():
parms['ts'] = current_time_13
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 触点传参时间超过32字符
def test_ts2():
parms['ts'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 167
# iss2s=1,ts为空
def test_ts3():
parms['ts'] = ""
parms['is_s2s'] = "1"
re = send_request('Yzuiuma', '')
assert re["status"] == 167
# iss2s=0,ts为空,跳转至监测链接的landing_page_url地址
def test_ts4():
parms['ts'] = ""
parms['is_s2s'] = "0"
send_request2('Yzuiuma', '')
# is_s2s为空,默认为0状态,跳转至监测链接的landing_page_url地址
def test_is_s2s1():
parms['is_s2s'] = ""
send_request2('Yzuiuma', '')
# is_s2s非0或者1
def test_is_s2s1():
parms['is_s2s'] = "2"
re = send_request('Yzuiuma', '')
assert re["status"] == 165
# 触点类型不为click
def test_touchpoint_type1():
parms['touchpoint_type'] = 'aaa'
re = send_request('Yzuiuma', '')
assert re["status"] == 163
# 触点类型为空
def test_touchpoint_type2():
parms['touchpoint_type'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 163
# 归因类型为空
def test_attribution_type1():
parms['attribution_type'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 164
# 归因类型为非ua
def test_attribution_type2():
parms['attribution_type'] = 'test'
re = send_request('Yzuiuma', '')
assert re["status"] == 164
# 操作系统为空
def test_os1():
parms['os'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 操作系统超过16个字符
def test_os1():
parms['os'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 115
# 操作系统正常
def test_os1():
parms['os'] = 'iOS'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 操作系统包含特殊字符
def test_os2():
parms['os'] = 'iOS#¥'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 设备型号为空
def test_model1():
parms['model'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 设备型号超过64字符
def test_model2():
parms['model'] = zf130
re = send_request('Yzuiuma', '')
assert re["status"] == 118
# 设备型号=64字符
def test_model3():
parms['model'] = zf64
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 用户公网IP v4版本,is_s2s为1
def test_ipv41():
parms['model'] = zf64
parms['is_s2s'] = '1'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 用户公网IP v4版本为空,is_s2s为1
def test_ipv42():
parms['ipv4'] = ""
parms['is_s2s'] = '1'
re = send_request('Yzuiuma', '')
assert re["status"] == 119
# 用户公网IP v4版本超过15字符
def test_ipv43():
parms['ipv4'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 119
# 用户公网IP v4版本为空,is_s2s为0,取http header中的ip作为ipv4/ua的值
def test_ipv44():
parms['ipv4'] = ""
parms['is_s2s'] = '0'
send_request2('Yzuiuma', '')
# 用户公网IP v4版本不为空,is_s2s为0,取传的ip值
def test_ipv45():
parms['ipv4'] = "2.34.34.34"
parms['is_s2s'] = '0'
send_request2('Yzuiuma', '')
# 用户公网ipv6版本超过128字符
def test_ipv61():
parms['ipv6'] = zf468
re = send_request('Yzuiuma', '')
assert re["status"] == 120
# 用户公网ipv6版本为空
def test_ipv62():
parms['ipv6'] = ""
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 用户公网ipv6版本为空
def test_ipv62():
parms['ipv6'] = ""
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 用户代理信息为空,is_s2s=1
def test_ua1():
parms['ua'] = ""
parms['is_s2s'] = '1'
re = send_request('Yzuiuma', '')
assert re["status"] == 121
# 用户代理信息超过512字符
def test_ua2():
parms['ua'] = zf668
parms['is_s2s'] = '1'
re = send_request('Yzuiuma', '')
assert re["status"] == 121
# 用户代理信息为空,is_s2s=0
def test_ua2():
parms['ua'] = ''
parms['is_s2s'] = '0'
send_request2('Yzuiuma', '')
# OAID超过512字符
def test_oaid1():
parms['oaid'] = zf668
re = send_request('Yzuiuma', '')
assert re["status"] == 126
# OAID为空
def test_oaid2():
parms['oaid'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# OAID小于512
def test_oaid3():
parms['oaid'] = '3DEA635F-B24F-434B-833F-4ED028FEAEEF'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# oaid_md5超过32字符
def test_oaid_md51():
parms['oaid_md5'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 127
# oaid_md5为空
def test_oaid_md52():
parms['oaid_md5'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# oaid_md5为32字符
def test_oaid_md53():
parms['oaid_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 各个设备的md5为32字符,大写
def test_oaid_md53():
newlist = ['oaid_md5', 'imei1_md5', 'imei2_md5', 'gaid_md5', 'mac_md5', 'android_id_md5']
for shebei_md5 in newlist:
parms[shebei_md5] = '8E488A40A17AED2F6752F51382A4EAFC'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# imei1超过32字符
def test_imei11():
parms['imei1'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 128
# imei1为空
def test_imei12():
parms['imei1'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# imei1为正常
def test_imei13():
parms['imei1'] = '8342732742383'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# imei1_md5非32字符
def test_imei1_md51():
parms['imei1_md5'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 129
# imei1_md5为32字符
def test_imei1_md53():
parms['imei1_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# imei1_md5为空
def test_imei1_md52():
parms['imei1_md5'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# imei2超过32字符
def test_imei21():
parms['imei2'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 130
# imei2为空
def test_imei22():
parms['imei2'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# imei2为32字符内
def test_imei23():
parms['imei2'] = '8342732742383'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# imei2_md5非32字符
def test_imei2_md51():
parms['imei2_md5'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 131
# imei2_md5为空
def test_imei2_md52():
parms['imei2_md5'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# imei2_md5为32字符
def test_imei2_md53():
parms['imei2_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# gaid非36字符
def test_gaid1():
parms['gaid'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 132
# gaid为空
def test_gaid2():
parms['gaid'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# gaid为36字符
def test_gaid3():
parms['gaid'] = 'B21C5EC5-9921-42FD-AAC5-07A0EB6CF1A0'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# gaid_md5非32字符
def test_gaid_md51():
parms['gaid_md5'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 133
# gaid_md5为空
def test_gaid_md52():
parms['gaid_md5'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# gaid_md5为32 字符
def test_gaid_md53():
parms['gaid_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# mac非17个字符
def test_mac1():
parms['mac'] = "111111"
re = send_request('Yzuiuma', '')
assert re["status"] == 134
# mac为空
def test_mac2():
parms['mac'] = ""
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# mac为17字符
def test_mac3():
parms['mac'] = "08:00:20:0A:8C:6D"
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# mac_md5非32字符
def test_mac_md51():
parms['mac_md5'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 135
# mac_md5为空
def test_mac_md52():
parms['gaid_md5'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# mac_md5 32字符
def test_mac_md53():
parms['gaid_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# android_id非16字符
def test_android_id1():
parms['android_id'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 136
# android_id为空
def test_android_id2():
parms['android_id'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# android_id为16字符
def test_android_id3():
parms['android_id'] = '1a34fc556a43c453'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# android_id_md5非32字符
def test_android_id_md51():
parms['android_id_md5'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 189
# android_id_md5为空
def test_android_id_md52():
parms['android_id_md5'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# android_id_md5为32字符
def test_android_id_md53():
parms['android_id_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 短链是安卓,传idfa
def test_idfa1():
parms['idfa'] = '3DEA635F-B24F-434B-833F-4ED028FEAEEF'
re = send_request('Yzuiuma', '')
assert re["status"] == 115
# 短链是安卓,传idfa_md5
def test_idfa_md51():
parms['idfa_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('Yzuiuma', '')
assert re["status"] == 115
# 短链是安卓,传idfv
def test_idfv1():
parms['idfv'] = '3DEA635F-B24F-434B-833F-4ED028FEAEEF'
re = send_request('Yzuiuma', '')
assert re["status"] == 115
# 短链是安卓,传idfv_md5
def test_idfv_md51():
parms['idfv_md5'] = '8e488a40a17aed2f6752f51382a4eafc'
re = send_request('Yzuiuma', '')
assert re["status"] == 115
# oaid","oaid_md5","imei1","imei1_md5","imei2","imei2_md5","mac","mac_md5","mac1","mac1_md5","gaid","gaid_md5"全部为空
def test_empty():
parms['oaid'] = ''
parms['oaid_md5'] = ''
parms['imei1'] = ''
parms['imei1_md5'] = ''
parms['imei2'] = ''
parms['imei2_md5'] = ''
parms['mac'] = ''
parms['mac_md5'] = ''
parms['mac1'] = ''
parms['mac1_md5'] = ''
parms['gaid_md5'] = ''
parms['gaid'] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 广告相关信息集合为空
def test_ads_data1():
newlist = ['account_id', 'adgroup_id', 'adgroup_name', 'adplan_id', 'adplan_name', 'adcreative_id',
'adcreative_name', 'adcreative_type', 'site_id', 'site_name', 'ad_type', 'placement_id', 'conversion_id',
'click_id', 'impression_id', 'request_id', 'callback_id', 'callback_url']
for ads_data in newlist:
parms[ads_data] = ''
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 广告账户id,广告组id,广告计划id,广告位id,转化id,广告点击id,广告展示id,广告请求id等于64字符
def test_ads_data2():
newlist = ['account_id', 'adgroup_id', 'adplan_id',
'placement_id', 'conversion_id',
'click_id', 'impression_id', 'request_id']
for ads_data in newlist:
parms[ads_data] = zf64
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 广告账户id,广告组id,广告计划id,广告位id,转化id,广告点击id,广告展示id,广告请求id超过64字符
def test_ads_data2():
newlist = [{'name': 'account_id', 'status': 168},
{'name': 'adgroup_id', 'status': 169},
{'name': 'adplan_id', 'status': 171},
{'name': 'placement_id', 'status': 179},
{'name': 'conversion_id', 'status': 180},
{'name': 'click_id', 'status': 181},
{'name': 'impression_id', 'status': 182},
{'name': 'request_id', 'status': 183},
]
for ads_data in newlist:
parms[ads_data['name']] = zf130
re = send_request('Yzuiuma', '')
assert re["status"] == ads_data['status']
# 广告组名称,广告计划名称,广告创意名称,渠道回调id,渠道回调地址超过256字符
def test_ads_data3():
newlist = [{'name': 'adgroup_name', 'status': 170},
{'name': 'adplan_name', 'status': 172},
{'name': 'adcreative_name', 'status': 174},
{'name': 'callback_id', 'status': 184},
{'name': 'callback_url', 'status': 185},
]
for ads_data in newlist:
parms[ads_data['name']] = zf468
re = send_request('Yzuiuma', '')
assert re["status"] == ads_data['status']
# 广告组名称,广告计划名称,广告创意名称,渠道回调id,渠道回调地址等于256字符
def test_ads_data4():
newlist = [{'name': 'adgroup_name', 'status': 0},
{'name': 'adplan_name', 'status': 0},
{'name': 'adcreative_name', 'status': 0},
{'name': 'callback_id', 'status': 0},
{'name': 'callback_url', 'status': 0},
]
for ads_data in newlist:
parms[ads_data['name']] = zf256
re = send_request('Yzuiuma', '')
assert re["status"] == ads_data['status']
# 广告组名称,广告计划名称,广告创意名称,渠道回调id,渠道回调地址小于256字符且包含特殊字符
def test_ads_data5():
newlist = [{'name': 'adgroup_name', 'status': 0},
{'name': 'adplan_name', 'status': 0},
{'name': 'adcreative_name', 'status': 0},
{'name': 'callback_id', 'status': 0},
{'name': 'callback_url', 'status': 0},
]
for ads_data in newlist:
parms[ads_data['name']] = '测试*test'
re = send_request('Yzuiuma', '')
assert re["status"] == ads_data['status']
# 广告创意id,流量媒体名称超过128字符
def test_ads_data6():
newlist = [{'name': 'adcreative_id', 'status': 0},
{'name': 'site_name', 'status': 0},
]
for ads_data in newlist:
parms[ads_data['name']] = zf130
re = send_request('Yzuiuma', '')
assert re["status"] == ads_data['status']
# 广告创意id,流量媒体名称等于128字符
def test_ads_data7():
newlist = [{'name': 'adcreative_id', 'status': 0},
{'name': 'site_name', 'status': 0},
]
for ads_data in newlist:
parms[ads_data['name']] = zf128
re = send_request('Yzuiuma', '')
assert re["status"] == ads_data['status']
# 创意类型,广告类型,流量媒体id超过32字符
def test_ads_data8():
newlist = [{'name': 'adcreative_type', 'status': 175},
{'name': 'site_id', 'status': 176},
{'name': 'ad_type', 'status': 178},
]
for ads_data in newlist:
parms[ads_data['name']] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == ads_data['status']
# 创意类型为16字符
def test_ads_data9():
parms['adcreative_type'] = '大图大图大图大图'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 流量媒体id为32字符字符
def test_ads_data10():
parms['site_id'] = '巨量的今日头条、穿山甲、抖音抖音'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 广告类型为32字符字符
def test_ads_data10():
parms['ad_type'] = '巨量的今日头条、穿山甲、抖音抖音'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 自定义触点参数1-10,为32字符内
def test_custom_params1():
parms['custom_params_1'] = '自定义触点参数'
parms['custom_params_2'] = '3333 带空格'
parms['custom_params_3'] = ' '
parms['custom_params_4'] = '32个字符32个字符32个字符32个字符'
parms['custom_params_5'] = ''
parms['custom_params_6'] = '……%¥#¥%……¥#'
parms['custom_params_7'] = '34343244'
parms['custom_params_8'] = 'tes rwe ew'
parms['custom_params_9'] = '_自定义'
parms['custom_params_10'] = 'test@#'
re = send_request('Yzuiuma', '')
assert re["status"] == 0
# 自定义触点参数,超过32字符
def test_custom_params2():
parms['custom_params_1'] = zf35
re = send_request('Yzuiuma', '')
assert re["status"] == 186
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 time
import random
headers = {'Content-Type': 'application/json', 'X-RY-Access-Token': 'test_access_token'}
# 测试环境
URL = 'http://10.2.20.42:8080/receive/tkio/'
# 时间戳
current_time_13 = int(round(time.time() * 1000))
# 时间和日期
when = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
# 日期
ds = time.strftime('%Y-%m-%d', time.localtime(time.time()))
# 设备品牌
manufacturer = 'vivo'
# 设备系统
ryos = 'android'
# 设备类型
rydevicetype = 'vivox9'
# 网络类型
network = 'wifi'
# 分辨率
resolution = '1344*750'
# 运行商
op = '中国移动'
# 支付类型 支付宝(alipay),银联(unionpay),微信支付(weixinpay),易宝支付(yeepay)
paymenttype = 'alipay'
# 货币类型
currencytype = 'CNY'
# 支付的货币金额
currencyamount = '90'
# # 填充广告在变现平台的广告位ID
# adid = '839296815'
# 填充广告的变现平台,例如穿山甲(csj)、优量汇(ylh)、百青藤(bqt)、Sigmob(sigmob)、快手(ks)、Mintegral(mintegral)、OneWay(oneway)、Vungle(vungle)等
adPlatform = 'ylh'
# 页面展示时调用 pageID代表页面唯一标识
# 会话时长,单位秒
appduration = '600'
# 时长,单位:秒
pageduration = '200'
istablet = 'phone'
lib = 'ios'
when1 = '2020-06-06 16:44:31'
# 设备型号
model = '测试1'
# 操作系统版本
ryosversion = '13.6.1'
# 网络环境
network_type = '5g'
# 运营商
carrier = '中国联通'
lv = '1.8.5'
class allEvent:
# 激活
def installUpload(self, i, IP, appkey):
s = json.dumps({
"application_info": {
"appkey": "8e488a40a17aed2f6752f51382a4eafc", # 应用唯一标识符。固定32字符,都必传。
"bundleid": "com.reyun.test", # iOS bundleid,Android package name,统一命名bundleid。限制128字符内,都必传。
"app_version": "1.0.1", # // 应用当前版本。限制32字符内,都选传。
"channel_name": "HUAWEI" # Android渠道包分包名称。限制32字符内,都必传。iOS只能是'default'。
},
# 应用信息。都必传。
"timestamp_info": {
"time_zone": "GMT+08",
# 时区。固定6字符,都必传。
"install_time": "1637823377000",
# // 激活时间。固定13字符,都必传。
"current_event_time": "1637823377000",
# // 当前事件的时间。固定13字符,都必传。
"report_time": "1637823377000"
# // 收集器发送当前事件时间。固定13子字符,sdk上报必传,s2s上报选传。
},
# // 时间戳信息。都必传。
"collector_info": {
"integration_type": "sdk",
# // 集成方式。固定为sdk或s2s。都必传。SDK方式上报时固定为sdk,S2S上报时固定为s2s。
"collector_version": "1.8.0",
# // 收集器版本。固定5字符。都必传。
"retried_times": "0"
# // 收集器重试次数(当SDK发送不成功时进行重试)。限制2字符内。都选传。
},
# // 收集器信息。都必传。
"device_info": {
"ryid": "8e488a40a17aed2f6752f51382a4eafc",
# // 热云设备唯一id(关联后续事件,MobDNA算法提供)。限制128字符内,暂无该参数。
"device_id": "8e488a40a17aed2f6752f51382a4eafc",
# // 热云设备唯一id(关联后续事件,tkio算法提供)。限制512字符内,与device_id_md5任选其一必传。
"device_id_type": "oaid",
# // device_id类型。限制16字符内。当device_id有值时必传。根据device_id_type的值确定device_id与其对应的设备id值是否一致,不一致报错。例:device_id_type为oaid,校验device_id与oaid值是否一致。
"device_id_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // device_id的md5值。固定32字符,与device_id任选其一必传。
"device_id_md5_type": "oaid_md5",
# // device_id_md5类型。限制16字符内。当device_id_md5有值时必传。根据device_id__md5_type的值确定device_id_md5与其对应的设备id值是否一致,不一致报错。例:device_id_md5_type为oaid_md5,校验device_id_md5与oaid_md5值是否一致.
"os": "android",
# // 操作系统。固定为ios、android或web。都必传。
"os_version": "10",
# // 操作系统版本。限制32位字符内。都必传。
"manufacturer": "HUAWEI",
# // 设备生产厂商。限制32字符内。都选传。
"model": "Mate 40",
# // 设备型号。限制64字符内。都选传。
"ipv4": "1.1.1.1",
# // 用户公网IPv4版本。限制15字符内。integration_type为sdk时选传,为s2s时必传。格式校验: *.*.*.* ,非此格式报错
"ipv6": "1.1.1.1",
# // 用户公网IPv6版本。限制128字符内。都选传。
"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",
# // 用户代理信息。限制512字符内。除os为android时都必传。
"att_status": "denied",
# // iOSATT框架启用状态。固定为denied、restricted、authorized或unknown。都选传。
"lat_status": "disable",
# // iOSLAT启用状态。固定为enable、disable、unknown。都选传。
"idfa": "3DEA635F-B24F-434B-833F-4ED028FEAEEF",
# // iOS IDFA原值。固定为36字符。与idfa_md5任选其一必传。Android上报报错。
"idfa_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // iOSIDFA原值MD5后转小写。固定为32字符。与idfa任选其一必传。Android上报报错。
"idfv": "3DEA635F-B24F-434B-833F-4ED028FEAEEF",
# // iOSIDFV原值。固定为36字符。与idfv_md5任选其一必传。Android上报报错。
"idfv_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // iOS IDFV原值MD5后转小写。固定为32字符。与idfv任选其一必传。Android上报报错。
"oaid": "3DEA635F-B24F-434B-833F-4ED028FEAEEF",
# // Android OAID原值。限制512字符内。选传,iOS上报报错。
"oaid_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // Android OAID原值MD5后转小写。固定为32字符。选传,iOS上报报错。
"imei1": "8342732742383",
# // Android主卡IMEI原值。限制32字符内。选传,iOS上报报错。
"imei1_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // Android主卡IMEI原值MD5后转小写。固定为32字符。选传,iOS上报报错。
"imei2": "8342732742383",
# // Android副卡IMEI原值。限制32字符内。选传,iOS上报报错。
"imei2_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // Android副卡IMEI原值MD5后转小写。固定为32字符。选传,iOS上报报错。
"gaid": "B21C5EC5-9921-42FD-AAC5-07A0EB6CF1A0",
# // GoogleAdvertising ID原值。固定36字符。选传,iOS上报报错。
"gaid_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // GoogleAdvertising ID原值MD5后转小写。固定为32字符。选传,iOS上报报错。
"mac": "B21C5EC5-9921-42FD-AAC5-07A0EB6CF1A0",
# // MAC原值。固定17字符。选传,iOS上报报错。
"mac_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // MAC原值MD5后转小写。固定为32字符。选传,iOS上报报错。
"android_id": "1a34fc556a43c453",
# // AndroidID原值。固定16字符。与android_id_md5任选其一必传。iOS上报报错。
"android_id_md5": "8e488a40a17aed2f6752f51382a4eafc"
# // AndroidID原值MD5后转小写。固定为32字符。与android_id任选其一必传。iOS上报报错。
},
# // 终端设备信息。都必传。
"event_info": {
"event_name": "install",
# // 事件名称。固定为install(激活)、startup(启动)、register(注册)、login(登陆)、order(订单)、purchase(付费)、adimpression(广告曝光)、adclick(广告点击)、custom_event_1 ~100(自定义事件共100个,名称限制数字、大小写字符、下划线,32
# 位字符内)
"event_type": "preset",
# // 事件类型。固定为preset(预置)和custom(自定义),都必传。
"event_data": {
"user_id": "guest123",
# // 用户id。限制128字符内。都必传(事件为install时可传 - 1或访客id)。
"register_type": "WeChat",
# // 注册类型。限制32字符内。register事件必传,其他事件选传。
"login_type": "Wechat",
# // 登陆类型。限制32字符内。login事件必传,其他事件选传。
"order_id": "2341242342676398724",
# // 订单id。限制128字符内。order和purchase事件必传,其他事件选传。
"order_amount": "343432",
# // 订单金额,单位:分。限制0和正整数。order和purchase事件必传,其他事件选传。
"currency_type": "CNY",
# // 货币类型,遵循《ISO 4217国际标准》。固定3字符。purchase事件必传,其他事件选传。
"purchase_type": "Alipay",
# // 支付类型。限制32字符内。purchase事件必传,其他事件选传。
"ad_platform": "csj",
# // 变现平台名称。限制32字符内。adimpression和adclick事件必传,其他事件选传。
"placement_type": "interstitial",
# // 广告位类型。限制32字符内。adimpression和adclick事件必传,其他事件选传。
"placement_id": "23425334",
# // 广告位id。限制128字符内。adimpression和adclick事件必传,其他事件选传。
"ad_price": "4.34",
# // 本次广告展示竞价金额。限制16字符内。adimpressio事件必传,其他事件选传。
"ad_price_currency_type": "CNY",
# // 货币类型,遵循《ISO4217国际标准》。固定3字符。adimpressio事件必传,其他事件选传。
"is_rendered": "1"
# // 本次广告是否渲染成功,1为成功,0 为失败。固定1字符。选传。
},
# // 事件数据。都必传
"custom_params": {
"add_cart": "234234",
# // 自定义参数。key限制数字、大小写字符、下划线,32 位字符内,value限制64字符内,都选传。(下同)
"sku": "234234",
"level_up": "234234",
"refund": "234234",
"refund_amount": "234234"
}
# // 事件自定义参数嵌套,内含参数最多10项。都选传。
}
# // 事件信息。都必传。
}
)
try:
p = requests.post(url=URL, data=s, headers=headers, timeout=5)
# , headers = headers
print("激活:" + p.text)
print("设备id:" + i)
print(p.url)
except Exception as err:
print(err)
import requests
import json
import time
import random
headers = {'Content-Type': 'application/json'}
# 测试环境
URL = 'http://10.2.8.155:32600/receive/tkiov2/sdk'
# 时间戳
current_time_13 = int(round(time.time() * 1000))
# 时间和日期
when = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
# 日期
ds = time.strftime('%Y-%m-%d', time.localtime(time.time()))
# 设备品牌
manufacturer = 'vivo'
# 设备系统
ryos = 'android'
# 设备类型
rydevicetype = 'vivox9'
# 网络类型
network = 'wifi'
# 分辨率
resolution = '1344*750'
# 运行商
op = '中国移动'
# 支付类型 支付宝(alipay),银联(unionpay),微信支付(weixinpay),易宝支付(yeepay)
paymenttype = 'alipay'
# 货币类型
currencytype = 'CNY'
# 支付的货币金额
currencyamount = '90'
# # 填充广告在变现平台的广告位ID
# adid = '839296815'
# 填充广告的变现平台,例如穿山甲(csj)、优量汇(ylh)、百青藤(bqt)、Sigmob(sigmob)、快手(ks)、Mintegral(mintegral)、OneWay(oneway)、Vungle(vungle)等
adPlatform = 'ylh'
# 页面展示时调用 pageID代表页面唯一标识
# 会话时长,单位秒
appduration = '600'
# 时长,单位:秒
pageduration = '200'
istablet = 'phone'
lib = 'ios'
when1 = '2020-06-06 16:44:31'
# 设备型号
model = '测试1'
# 操作系统版本
ryosversion = '13.6.1'
# 网络环境
network_type = '5g'
# 运营商
carrier = '中国联通'
lv = '1.8.5'
class allEvent:
# 激活
def installUpload(self, i, IP, appkey):
s = json.dumps([{
"application_info": {
"appkey": "8e488a40a17aed2f6752f51382a4eafc", # 应用唯一标识符。固定32字符,都必传。
"bundleid": "com.reyun.test", # iOS bundleid,Android package name,统一命名bundleid。限制128字符内,都必传。
"app_version": "1.0.1", # // 应用当前版本。限制32字符内,都选传。
"channel_name": "HUAWEI" # Android渠道包分包名称。限制32字符内,都必传。iOS只能是'default'。
},
# 应用信息。都必传。
"timestamp_info": {
"time_zone": "GMT+08",
# 时区。固定6字符,都必传。
"install_time": "1637823377000",
# // 激活时间。固定13字符,都必传。
"current_event_time": "1637823377000",
# // 当前事件的时间。固定13字符,都必传。
"report_time": "1637823377000"
# // 收集器发送当前事件时间。固定13子字符,sdk上报必传,s2s上报选传。
},
# // 时间戳信息。都必传。
"collector_info": {
"integration_type": "sdk",
# // 集成方式。固定为sdk或s2s。都必传。SDK方式上报时固定为sdk,S2S上报时固定为s2s。
"collector_version": "1.8.0",
# // 收集器版本。固定5字符。都必传。
"retried_times": "0"
# // 收集器重试次数(当SDK发送不成功时进行重试)。限制2字符内。都选传。
},
# // 收集器信息。都必传。
"device_info": {
"ryid": "8e488a40a17aed2f6752f51382a4eafc",
# // 热云设备唯一id(关联后续事件,MobDNA算法提供)。限制128字符内,暂无该参数。
"device_id": "8e488a40a17aed2f6752f51382a4eafc",
# // 热云设备唯一id(关联后续事件,tkio算法提供)。限制512字符内,与device_id_md5任选其一必传。
"device_id_type": "oaid",
# // device_id类型。限制16字符内。当device_id有值时必传。根据device_id_type的值确定device_id与其对应的设备id值是否一致,不一致报错。例:device_id_type为oaid,校验device_id与oaid值是否一致。
"device_id_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // device_id的md5值。固定32字符,与device_id任选其一必传。
"device_id_md5_type": "oaid_md5",
# // device_id_md5类型。限制16字符内。当device_id_md5有值时必传。根据device_id__md5_type的值确定device_id_md5与其对应的设备id值是否一致,不一致报错。例:device_id_md5_type为oaid_md5,校验device_id_md5与oaid_md5值是否一致.
"os": "android",
# // 操作系统。固定为ios、android或web。都必传。
"os_version": "10",
# // 操作系统版本。限制32位字符内。都必传。
"manufacturer": "HUAWEI",
# // 设备生产厂商。限制32字符内。都选传。
"model": "Mate 40",
# // 设备型号。限制64字符内。都选传。
"ipv4": "1.1.1.1",
# // 用户公网IPv4版本。限制15字符内。integration_type为sdk时选传,为s2s时必传。格式校验: *.*.*.* ,非此格式报错
"ipv6": "1.1.1.1",
# // 用户公网IPv6版本。限制128字符内。都选传。
"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",
# // 用户代理信息。限制512字符内。除os为android时都必传。
"att_status": "denied",
# // iOSATT框架启用状态。固定为denied、restricted、authorized或unknown。都选传。
"lat_status": "disable",
# // iOSLAT启用状态。固定为enable、disable、unknown。都选传。
"idfa": "3DEA635F-B24F-434B-833F-4ED028FEAEEF",
# // iOS IDFA原值。固定为36字符。与idfa_md5任选其一必传。Android上报报错。
"idfa_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // iOSIDFA原值MD5后转小写。固定为32字符。与idfa任选其一必传。Android上报报错。
"idfv": "3DEA635F-B24F-434B-833F-4ED028FEAEEF",
# // iOSIDFV原值。固定为36字符。与idfv_md5任选其一必传。Android上报报错。
"idfv_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // iOS IDFV原值MD5后转小写。固定为32字符。与idfv任选其一必传。Android上报报错。
"oaid": "3DEA635F-B24F-434B-833F-4ED028FEAEEF",
# // Android OAID原值。限制512字符内。选传,iOS上报报错。
"oaid_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // Android OAID原值MD5后转小写。固定为32字符。选传,iOS上报报错。
"imei1": "8342732742383",
# // Android主卡IMEI原值。限制32字符内。选传,iOS上报报错。
"imei1_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // Android主卡IMEI原值MD5后转小写。固定为32字符。选传,iOS上报报错。
"imei2": "8342732742383",
# // Android副卡IMEI原值。限制32字符内。选传,iOS上报报错。
"imei2_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // Android副卡IMEI原值MD5后转小写。固定为32字符。选传,iOS上报报错。
"gaid": "B21C5EC5-9921-42FD-AAC5-07A0EB6CF1A0",
# // GoogleAdvertising ID原值。固定36字符。选传,iOS上报报错。
"gaid_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // GoogleAdvertising ID原值MD5后转小写。固定为32字符。选传,iOS上报报错。
"mac": "B21C5EC5-9921-42FD-AAC5-07A0EB6CF1A0",
# // MAC原值。固定17字符。选传,iOS上报报错。
"mac_md5": "8e488a40a17aed2f6752f51382a4eafc",
# // MAC原值MD5后转小写。固定为32字符。选传,iOS上报报错。
"android_id": "1a34fc556a43c453",
# // AndroidID原值。固定16字符。与android_id_md5任选其一必传。iOS上报报错。
"android_id_md5": "8e488a40a17aed2f6752f51382a4eafc"
# // AndroidID原值MD5后转小写。固定为32字符。与android_id任选其一必传。iOS上报报错。
},
# // 终端设备信息。都必传。
"event_info": {
"event_name": "install",
# // 事件名称。固定为install(激活)、startup(启动)、register(注册)、login(登陆)、order(订单)、purchase(付费)、adimpression(广告曝光)、adclick(广告点击)、custom_event_1 ~100(自定义事件共100个,名称限制数字、大小写字符、下划线,32
# 位字符内)
"event_type": "preset",
# // 事件类型。固定为preset(预置)和custom(自定义),都必传。
"event_data": {
"user_id": "guest123",
# // 用户id。限制128字符内。都必传(事件为install时可传 - 1或访客id)。
"register_type": "WeChat",
# // 注册类型。限制32字符内。register事件必传,其他事件选传。
"login_type": "Wechat",
# // 登陆类型。限制32字符内。login事件必传,其他事件选传。
"order_id": "2341242342676398724",
# // 订单id。限制128字符内。order和purchase事件必传,其他事件选传。
"order_amount": "343432",
# // 订单金额,单位:分。限制0和正整数。order和purchase事件必传,其他事件选传。
"currency_type": "CNY",
# // 货币类型,遵循《ISO 4217国际标准》。固定3字符。purchase事件必传,其他事件选传。
"purchase_type": "Alipay",
# // 支付类型。限制32字符内。purchase事件必传,其他事件选传。
"ad_platform": "csj",
# // 变现平台名称。限制32字符内。adimpression和adclick事件必传,其他事件选传。
"placement_type": "interstitial",
# // 广告位类型。限制32字符内。adimpression和adclick事件必传,其他事件选传。
"placement_id": "23425334",
# // 广告位id。限制128字符内。adimpression和adclick事件必传,其他事件选传。
"ad_price": "4.34",
# // 本次广告展示竞价金额。限制16字符内。adimpressio事件必传,其他事件选传。
"ad_price_currency_type": "CNY",
# // 货币类型,遵循《ISO4217国际标准》。固定3字符。adimpressio事件必传,其他事件选传。
"is_rendered": "1"
# // 本次广告是否渲染成功,1为成功,0 为失败。固定1字符。选传。
},
# // 事件数据。都必传
"custom_params": {
"add_cart": "234234",
# // 自定义参数。key限制数字、大小写字符、下划线,32 位字符内,value限制64字符内,都选传。(下同)
"sku": "234234",
"level_up": "234234",
"refund": "234234",
"refund_amount": "234234"
}
# // 事件自定义参数嵌套,内含参数最多10项。都选传。
}
# // 事件信息。都必传。
}]
)
try:
p = requests.post(url=URL, data=s, headers=headers, timeout=5)
# , headers = headers
print("激活:" + p.text)
print("设备id:" + i)
print(p.url)
except Exception as err:
print(err)
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