click.py 3.87 KB
Newer Older
liuxiaoxing committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
from online_android_event.android_script import allEvent
import random
import requests
import socket
import struct
import time

#向短链发送点击数据


#线上环境
# URL = 'http://uri6.com/tkio/eI7fyya?kwid=关键词&creative=创意2'
# URL = 'http://uri6.com/tkio/yIJVjia?kwid=关键词3&creative=创意'
URL = 'http://uri6.com/tkio/qmAN7ja'
# ?impression=true
# &noredirect=true
appkey = '16dc0cb882d3dbec4f7f66251a84d6dd'
event = 'event_2'
# 广告创意ID
ry_adcreative_id = '1655250814523437'
# 广告组ID
ry_adgroup_id = '1653408012613659'
# 广告计划ID
ry_adplan_id = '1655246785946685'
# 广告组名称
ry_adgroup_name = '头条广告组1'
# 广告计划名称
ry_adplan_name = '头条广告计划1'
# 广告创意名称
ry_adcreative_name = '头条广告名称1'
s=0
w=0
for _ in range(1):

    #随机生成12为数组
    i = ''.join(str(random.choice(range(10))) for _ in range(12))
    # i = '085071184873'
    # ip6 = socket.i net_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
    # a = ''.join(str(random.choice(range(10))) for _ in range(12))
    # o = ''.join(str(random.choice(range(10))) for _ in range(12))
    # mac = ''.join(str(random.choice(range(10))) for _ in range(12))
    # i = '321232113212'
    #随机生成ip
    ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
    # ip = '172.31.21.207'
    # mac = 'e3f5536a141811db40efd6400f1d0a4e'
    try:

        parms = {
                'imei': i,
                 # "idfa": '3F88CD9A-D90B-4448-BFF8-18B9A223B204',
                'ip': ip,
                # 'aid': '54676',
                # 'siteid': '68793',
                # 'csite': '4355743'
                # 'deviceid': '0000000000'
                # 'muid': '5F126EA0AD05CFE52675C3518B240540D5C10733'
                # 'ipv6':ip6
                # 'androidid':"fverr43tfv34erdcd23e",
                # 'oaid': "754b3e3e-a274-ed22-cebf-2b6dddfc28b9",
                # 'mac': mac
                # 'subchannel': "111",
                # "ry_adcreative_id": ry_adcreative_id,
                # "ry_adgroup_id": ry_adgroup_id,
                # "ry_adplan_id": ry_adplan_id,
                # 'ry_adgroup_name': ry_adgroup_name,
                # 'ry_adplan_name': ry_adplan_name,
                # 'ry_adcreative_name':ry_adcreative_name,
                # 'adId':'',
                # "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",

        }
        #timeout可以超时四秒
        p = requests.get(url=URL, params=parms, timeout=4, verify=False)
        print('success:', s)
        print('imei:', i)
        print('ip:', ip)
        # print(p.text)
        # print("androidid",a)
        # print("oaid",o)
        # print("mac",mac)
        # print("ip6:"+ip6)
        s=s+1
    except requests.exceptions.RequestException:

        print('wrong:',w)
        print('imei:', i)
        print('ip', ip)
        w = w+1
        # continue
    time.sleep(10)
    try:
        allEvent().installUpload(i, ip, appkey)
        # allEvent().formevent(i, ip, appkey)
    #
    except Exception:
        print('install_wrong:', w)
        w = w + 1
    time.sleep(1)
    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(3)
    try:
        allEvent().ziding_event(i, ip, appkey, event)
    except Exception as err:
        print(err)
        print('自定义_wrong:', w)
    time.sleep(3)
    try:
        allEvent().payEvent(i, ip, appkey)
    except Exception as err:
        print(err)
        print('付费_wrong:', w)
    time.sleep(3)
    try:
        allEvent().orderEvent(i, ip, appkey)
    except Exception:
        print('订单_wrong:', w)