click.py 2.96 KB
Newer Older
1 2 3 4 5 6 7
# -*- coding: utf-8 -*-
"""
@author:zhaiht
@file:  click.py
@time:  2020/8/4 13:56
@desc:  android click
"""
8
import os
9 10 11
import random
import socket
import struct
zhaihuitao committed
12
from config.envcfg import prod
zhaihuitao committed
13 14
from common import randomUtil
from config.envcfg import prod_params
zhaihuitao committed
15
import sys
zhaihuitao committed
16
import requests
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

# 向短链发送点击数据
# !!!!分包需要删掉https的s

event = 'event_12'
cmpaignid = '3333'
# 广告创意ID
ry_adcreative_id = '999'
# 广告组ID
ry_adgroup_id = '999'
# 广告计划ID
ry_adplan_id = '999'
# 广告组名称
ry_adgroup_name = '广告组'
# 广告计划名称
ry_adplan_name = '广告计划'
# 广告创意名称
ry_adcreative_name = '广告创意'
s = 0
w = 0

38

39 40 41
for _ in range(1):

    #随机生成12为数组
zhaihuitao committed
42
    # i = ''.join(str(random.choice(range(10))) for _ in range(12))
43 44
    # i = '167070728336'
    #随机生成ip
zhaihuitao committed
45
    # ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
46 47
    # ip = '175.93.28.70'
    try:
zhaihuitao committed
48
        '''parms = {
49
                # 'androidid': "43214532142142",
zhaihuitao committed
50
                'imei': randomUtil.r.randimei(),
51
                # "idfa": 'DBC13622-E34B-440C-B7A7-FB6641D0D9AB',
zhaihuitao committed
52
                'ip': randomUtil.r.randip(),
53 54 55 56 57 58 59
                # "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,
zhaihuitao committed
60
        }'''
61 62 63

        #timeout可以超时四秒
        # verify = False
zhaihuitao committed
64
        p = requests.get(url=prod['click'][1], params=prod_params, timeout=30, verify=False)
65

zhaihuitao committed
66
        print('success:', s)
67
        # print(p.text)
zhaihuitao committed
68
        print('imei:',randomUtil.r.randimei())
69 70
    except requests.exceptions.RequestException:

zhaihuitao committed
71
        print('wrong:', w)
zhaihuitao committed
72 73
        print('imei:', randomUtil.r.randimei())
        print('ip', randomUtil.r.randip())
74 75 76 77
        w=w+1
        continue
    # time.sleep(7)
    # try:
zhaihuitao committed
78
        allEvent().installUpload(i, ip, appkey, cmpaignid)
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
    # except Exception as err:
    #     print('install_wrong:', w)
    #     w = w + 1
    #     print(err)
    # time.sleep(1)
    # try:
    #     allEvent().registerEvent(i, ip, appkey)
    # except Exception as e:
    #     print('注册_wrong:', w)
    #     print(e)
    # #     continue
    # time.sleep(2)
    # try:
    #     allEvent().loginEvent(i, ip, appkey)
    # except Exception:
    #     print('登录_wrong:', w)
    # time.sleep(5)
    # try:
    #     allEvent().payEvent(i, ip, appkey)
    # except Exception:
    #     print('付费_wrong:', w)
    # time.sleep(2)
    # try:
    #     allEvent().ziding_event(i, ip, appkey,event)
    # except Exception:
    #     print('自定义_wrong:', w)