Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tkio-test-case
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuxiaoxing
tkio-test-case
Commits
f68d5708
Commit
f68d5708
authored
Mar 02, 2022
by
liuxiaoxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
443c541a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
154 additions
and
154 deletions
+154
-154
misc.xml
.idea/misc.xml
+2
-1
jifenqiang.py
jifenqiang.py
+0
-2
attributioncase.py
microservices/attributioncase.py
+150
-145
clickparams.py
microservices/clickparams.py
+2
-6
No files found.
.idea/misc.xml
View file @
f68d5708
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"
NewPython 3.7 (test
)"
project-jdk-type=
"Python SDK"
/>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"
Python 3.9 (PythonProjects
)"
project-jdk-type=
"Python SDK"
/>
</project>
\ No newline at end of file
jifenqiang.py
View file @
f68d5708
...
...
@@ -14,6 +14,5 @@ s = json.dumps({
"appid"
:
"1234557890"
})
p
=
requests
.
post
(
test_url
,
data
=
s
)
print
(
p
)
\ No newline at end of file
microservices/attributioncase.py
View file @
f68d5708
# from .import clickparams
from
microservices
import
clickparams
import
socket
import
struct
import
random
...
...
@@ -6,151 +7,155 @@ import random
import
requests
import
json
URL
=
'http://tmtest.trackingio.com/receive/turl/Yzuiuma'
clickparams
.
parms_ios
[
'os'
]
=
'android'
response
=
requests
.
get
(
url
=
URL
,
params
=
clickparams
.
parms
.
update
(
clickparams
.
parms_ios
),
timeout
=
10
,
verify
=
False
)
print
(
clickparams
.
parms
)
print
(
response
.
text
)
s
=
0
w
=
0
for
index
in
range
(
1
):
# print("开始时间"+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
# 随机生成12为数组
i
=
''
.
join
(
str
(
random
.
choice
(
range
(
10
)))
for
_
in
range
(
12
))
# # 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对象
# 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 = '156.119.456.199'
try
:
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'
,
# 监测短链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
%3
A
%2
F
%2
Ftracking.e.qq.com
%2
Fconv
%3
Fcb
%3
DMTIzYWJjNDU2ZGVm
%26
conv_id
%3
D12345678'
,
# 自定触点参数集合。都选传。
'custom_params_1'
:
''
,
# 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'
:
i
,
# 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'
:
''
,
}
# timeout可以超时四秒
# verify = False
p
=
requests
.
get
(
url
=
URL
,
params
=
parms
,
timeout
=
10
,
verify
=
False
)
print
(
'imei:'
,
i
)
print
(
"ip:"
,
ip
)
# print("accountid:", accountid)
print
(
p
.
text
)
print
(
p
.
url
)
# print("oaid:",o)
print
(
'success:'
,
s
)
print
(
p
.
status_code
)
print
(
p
.
content
)
# print('androidid:',a)
# print(nowTime)
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
\ No newline at end of file
# for index in range(1):
# # print("开始时间"+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
# # 随机生成12为数组
# i = ''.join(str(random.choice(range(10))) for _ in range(12))
# # 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对象
# # 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 = '156.119.456.199'
# try:
# 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',
# # 监测短链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': '' ,
# # 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': i,
# # 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': '',
# }
# # timeout可以超时四秒
# # verify = False
# p = requests.get(url=URL, params=parms, timeout=10, verify=False)
# print('imei:', i)
# print("ip:", ip)
# # print("accountid:", accountid)
# print(p.text)
# print(p.url)
# # print("oaid:",o)
# print('success:', s)
# print(p.status_code)
# print(p.content)
# # print('androidid:',a)
# # print(nowTime)
# 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
\ No newline at end of file
microservices/clickparams.py
View file @
f68d5708
...
...
@@ -3,8 +3,6 @@ parms = {
'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的值
...
...
@@ -62,8 +60,8 @@ parms = {
}
parmsios
=
{
parms_ios
=
{
# 操作系统。限制16字符内。都选传。短链传参。暂不与app_platform互相做校验。
'os'
:
'ios'
,
# iOS IDFA原值。固定为36字符
...
...
@@ -74,7 +72,7 @@ parmsios = {
}
parmsandroid
=
{
parms
_
android
=
{
# Android OAID原值。限制512字符内。Android选传,app_platform=ios时报错
'oaid'
:
'3DEA635F-B24F-434B-833F-4ED028FEAEEF'
,
# Android OAID原值MD5后转小写。固定为32字符。Android选传,app_platform=ios时报错
...
...
@@ -99,5 +97,4 @@ parmsandroid = {
'android_id'
:
''
,
# Android ID原值MD5后转小写。固定为32字符。Android选传,app_platform=ios时报错
'android_id_md5'
:
''
,
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment