Commit 0e96f097 by zhaihuitao

add install enevt

parent 4a0f7810
...@@ -32,9 +32,9 @@ prod_params = { ...@@ -32,9 +32,9 @@ prod_params = {
"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko)Version/5.1 " "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', "Mobile/9A334 Safari/7534.48.3", 'creativeId': '21321321312123', 'requestId': '312321321312',
"adId": long('21231'), "adId": long('21231'),
'ry_adgroup_name': "头条广告组2", "ry_adgroup_name": "头条广告组2",
'ry_adplan_name': "头条广告计划2", "ry_adplan_name": "头条广告计划2",
'ry_adcreative_name': "头条广告名称2", "ry_adcreative_name": "头条广告名称2",
"ry_adgroup_id": 999, "ry_adgroup_id": 999,
"ry_adplan_id": 999, "ry_adplan_id": 999,
"ry_adcreative_id": 999, "ry_adcreative_id": 999,
......
# -*- coding: utf-8 -*-
"""
@author:zhaiht
@file: params.py
@time: 2020/8/11 15:08
@desc:
"""
import time
params_install = {
"what":'install',
"appid": "9b17c1568c3ce34599c5fd2778483ff9",
"context": {
"_carrier": "中国联通",
"_network_type": "5G",
"_ryosversion": "10.0.0",
"_model": "test1",
"_pkgname": "com.yanjing.yami",
"_campaignid": 'default',
"_deviceid": "CFFEF74E-B6BF-BD16-E7F8-DFDBFF5FB6E1",
"_imei": "cffef74e-b6bf-bd16-e7f8-dfdbff5fb6e1",
# "_idfa": 'DBC13622-E34B-440C-B7A7-FB6641D0D9AB',
# "_androidid": "43214532142142",
# "_imei2":"324323AAAA",
# "_meid": "CCC324323",
"_ip": "119.57.108.226",
# "_ipv6": i,
'_manufacturer': "HUAWEI",
'_ryos': "Android",
'_rydevicetype': "LYA-AL00",
'_network': "WIFI",
'_resolution': "1080*2265",
'_op': "中国移动",
'_timestamp': int(round(time.time() * 1000)),
'_oaid': '234B9U1T-A274-ED22-CEBF-4B6DDDFC18A9',
# '_mac': "12321321321321321",
"_istablet": "phone",
"_lib": "Android",
"_lib_version": "1.5.0",
},
# 'when': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())),
# time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
# 'ds': ds,
'who': 'lxx_test'
}
\ No newline at end of file
...@@ -6,49 +6,17 @@ ...@@ -6,49 +6,17 @@
@desc: @desc:
""" """
class allEvent: import requests
# 激活 import json
def installUpload(self, i, IP, appkey): from config.envcfg import prod, prod_params
s = json.dumps({ from config.prod.params import params_install
# "what":'install',
"appid": appkey,
"context": {
"_carrier": carrier,
"_network_type": network_type,
"_ryosversion": ryosversion,
"_model": model,
"_pkgname": "com.yanjing.yami",
"_campaignid": 'default',
"_deviceid": i,
"_imei": i,
# "_idfa": 'DBC13622-E34B-440C-B7A7-FB6641D0D9AB',
# "_androidid": "43214532142142",
# "_imei2":"324323AAAA",
# "_meid": "CCC324323",
"_ip": IP,
# "_ipv6": i,
'_manufacturer': manufacturer,
'_ryos': ryos,
'_rydevicetype': rydevicetype,
'_network': network,
'_resolution': resolution,
'_op': op,
'_timestamp': current_time_13,
'_oaid': '234B9U1T-A274-ED22-CEBF-4B6DDDFC18A9',
# '_mac': "12321321321321321",
"_istablet": istablet,
"_lib": lib,
"_lib_version": lv,
},
# 'when': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())),
# time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
# 'ds': ds,
'who': 'lxx_test'
}) class allEvent:
# 激活
def installUpload(self):
try: try:
p = requests.post(url=URL + 'install', data=s, headers=headers, timeout=5) p = requests.post(url=prod["events"]["url"] + 'install', data=json.dumps(params_install), headers=headers, timeout=5)
print("激活:" + p.text) print("激活:" + p.text)
print("设备id:" + i) print("设备id:" + i)
print(p.url) print(p.url)
...@@ -86,7 +54,6 @@ class allEvent: ...@@ -86,7 +54,6 @@ class allEvent:
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) print("今日头条表单" + p.text)
# 启动 # 启动
def startupEvent(self, i, IP, appkey): def startupEvent(self, i, IP, appkey):
s = json.dumps( s = json.dumps(
...@@ -517,3 +484,5 @@ class allEvent: ...@@ -517,3 +484,5 @@ class allEvent:
print("App使用时长:" + p.text) print("App使用时长:" + p.text)
except Exception as err: except Exception as err:
print(err) print(err)
a = allEvent()
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
@author:zhaiht
@file: installEvent.py
@time: 2020/8/11 15:29
@desc:
"""
import requests
import json
from config.envcfg import prod, prod_params
from config.prod.params import params_install
headers = {'Content-Type': 'application/json'}
class allEvent:
# 激活
def installUpload(self):
try:
p = requests.post(url=prod["events"]["url"] + 'install', data=json.dumps(params_install), headers=headers, timeout=5)
print("激活:" + p.text)
# print("设备id:" + i)
print(p.url)
except Exception as err:
print(err)
a = allEvent()
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
@author:zhaiht
@file: test_install.py
@time: 2020/8/11 16:22
@desc:
"""
import unittest
from testcase.android_click.installEvent import allEvent
class installTestCase(unittest.TestCase):
def install(self):
allEvent.installUpload(self)
\ No newline at end of file
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