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)