def complain_context(self, content, type): """ 提交用户反馈 :param content: 反馈内容 :return: """ post_data = { "content": "%s" % content, "type": "%d" % type } # 1:功能建议;2:产品BUG headers = { "Cache - Control": "no - cache", "Content - Type": "text / html;charset = UTF - 8", 'Accept': 'application/json', 'Authorization': Login().login("18708125570", "aaaaaa")["data"]["auth_token"], "Date": "%s" % GetCurrentTime().getHeaderTime(), "Proxy - Connection": "Keep - alive", "Server": "nginx / 1.9.3(Ubuntu)", "Transfer - Encoding": "chunked" } complain_type_url = "http://%s/complaint/opinion" % ConfigFile().host() request = requests.post(complain_type_url, data=post_data, headers=headers) time = GetCurrentTime().getCurrentTime() status_code = request.status_code try: if status_code in (200, 422): json = request.json() info = json["info"] return json else: info = request.reason finally: log_list = [ u'提交用户反馈', u"post", complain_type_url, str(post_data), time, status_code, info ] # 单条日志记录 GetReport().get_report() # 生成或打开日志文件 GetReport().record_into_report(log_list) # 逐条写入日志
'Authorization': token, "Date": "%s" % GetTime().getHeaderTime(), "Proxy - Connection": "Keep - alive", "Server": "nginx / 1.9.3(Ubuntu)", "Transfer - Encoding": "chunked" } ban_list_url = "http://%s/activity/%d/banheros" % (ConfigFile().host(), self.match_id) request = requests.get(ban_list_url, post_data, headers=headers) time = GetTime().getCurrentTime() status_code = request.status_code try: if status_code in (200, 422): json = request.json() info = json["info"] return json else: info = request.reason finally: log_list = [ u'获取对手选择的英雄或地图', u"get", ban_list_url, str(post_data), time, status_code, info ] # 单条日志记录 # GetReport().get_report() # 生成或打开日志文件 # GetReport().record_into_report(log_list) # 逐条写入日志 if __name__ == '__main__': token = Login().login("14700000004", "aaaaaa")["data"]["auth_token"] _run = BanList() print(_run.ban_list(token))
"Server": "nginx / 1.9.3(Ubuntu)", "Transfer - Encoding": "chunked" } get_invate_code_url = "http://%s/member/fillcode" % ConfigFile().host() request = requests.post(get_invate_code_url, data=post_data, headers=headers) time = GetCurrentTime().getCurrentTime() status_code = request.status_code try: if status_code in (200, 422): json = request.json() info = json["info"] return json else: info = request.reason finally: log_list = [ u'获取邀请码', u"post", get_invate_code_url, str(post_data), time, status_code, info ] # 单条日志记录 GetReport().get_report() # 生成或打开日志文件 GetReport().record_into_report(log_list) # 逐条写入日志 if __name__ == "__main__": login = Login().login("18708125570", "aaaaaa") fromcode = GetInviteCode().get_invite_code(login)["data"]["code"] r = FillinInviteCode() print(r.fillin_invite_code(login, fromcode))
"Date": "%s" % GetCurrentTime().getHeaderTime(), "Proxy - Connection": "Keep - alive", "Server": "nginx / 1.9.3(Ubuntu)", "Transfer - Encoding": "chunked" } record_url = "http://%s/activity/%d/record" % (ConfigFile().host(), match_id) request = requests.get(record_url, post_data, headers=headers) time = GetCurrentTime().getCurrentTime() status_code = request.status_code print(request) try: if status_code in (200, 422): json = request.json() info = json["info"] return json else: info = request.reason finally: log_list = [ u'场次记录', u"get", record_url, str(post_data), time, status_code, info ] # 单条日志记录 # GetReport().get_report() # 生成或打开日志文件 # GetReport().record_into_report(log_list) # 逐条写入日志 if __name__ == '__main__': login = Login().login("14700000001", "aaaaaa") _run = Record() print(_run.record(login, 19))
'Authorization': login["data"]["auth_token"], "Date": "%s" % GetCurrentTime().getHeaderTime(), "Proxy - Connection": "Keep - alive", "Server": "nginx / 1.9.3(Ubuntu)", "Transfer - Encoding": "chunked" } match_created_url = "http://%s/activity/found/%d" % ( ConfigFile().host(), status) request = requests.get(match_created_url, post_data, headers=headers) time = GetCurrentTime().getCurrentTime() status_code = request.status_code try: if status_code in (200, 422): json = request.json() info = json["info"] return json else: info = request.reason finally: log_list = [ u'我发布的比赛', u"get", match_created_url, str(post_data), time, status_code, info ] # 单条日志记录 GetReport().get_report() # 生成或打开日志文件 GetReport().record_into_report(log_list) # 逐条写入日志 if __name__ == '__main__': login = Login().login(GetUsers().get_mobile(), GetUsers().get_password()) _run = MatchCreated() print(_run.match_created(login, 1))
"Date": "%s" % GetCurrentTime().getHeaderTime(), "Proxy - Connection": "Keep - alive", "Server": "nginx / 1.9.3(Ubuntu)", "Transfer - Encoding": "chunked" } match_rule_url = "http://%s/activity/rule" % ConfigFile().host() request = requests.get(match_rule_url, post_data, headers=headers) time = GetCurrentTime().getCurrentTime() status_code = request.status_code try: if status_code in (200, 422): json = request.json() info = json["info"] return json else: info = request.reason finally: log_list = [ u'创建比赛-比赛规则', u"get", match_rule_url, str(post_data), time, status_code, info ] # 单条日志记录 # GetReport().get_report() # 生成或打开日志文件 # GetReport().record_into_report(log_list) # 逐条写入日志 if __name__ == '__main__': judgement_token = Login().login("14700000001", "aaaaaa")["data"]["auth_token"] _run = MatchRule() print(_run.match_rule(judgement_token, 1)) print(random.choice(_run.match_rule(judgement_token, 1)["data"])["id"])
"Date": "%s" % GetCurrentTime().getHeaderTime(), "Proxy - Connection": "Keep - alive", "Server": "nginx / 1.9.3(Ubuntu)", "Transfer - Encoding": "chunked" } match_people_url = "http://%s/activity/people" % ConfigFile().host() request = requests.get(match_people_url, post_data, headers=headers) time = GetCurrentTime().getCurrentTime() status_code = request.status_code try: if status_code in (200, 422): json = request.json() info = json["info"] return json else: info = request.reason finally: log_list = [ u'创建比赛-人数方案', u"get", match_people_url, str(post_data), time, status_code, info ] # 单条日志记录 # GetReport().get_report() # 生成或打开日志文件 # GetReport().record_into_report(log_list) # 逐条写入日志 if __name__ == '__main__': judgement_token = Login().login("18708125570", "aaaaaa")["data"]["auth_token"] _run = MatchPeople() print(_run.match_people(judgement_token, 1)) print(_run.match_people(judgement_token, 1)["data"][0]["count"])
def __init__(self): config_file = ConfigFile() self.judgement_token = Login().login( config_file.judgement()[0], config_file.judgement()[1])["data"]["auth_token"] self.match_id = config_file.activity_id()
} personal_info_url = "http://%s/member/updateinfo" % ConfigFile().host() request = requests.put(personal_info_url, data=post_data, headers=headers) time = GetCurrentTime().getCurrentTime() status_code = request.status_code try: if status_code in (200, 422): json = request.json() info = json["info"] return json else: info = request.reason finally: log_list = [ u'编辑个人资料', u"put", personal_info_url, str(post_data), time, status_code, info ] # 单条日志记录 # GetReport().get_report() # 生成或打开日志文件 # GetReport().record_into_report(log_list) # 逐条写入日志 if __name__ == "__main__": r = PersonalUpdate() users = Register().register_user() print(len(users)) for user in users: login = Login().login(user, "aaaaaa") print(r.personal_update(login))
request = requests.post(add_role_url, data=post_data, headers=headers) time = GetTime().getCurrentTime() status_code = request.status_code try: if status_code in (200, 422): json = request.json() info = json["info"] return json else: info = request.reason finally: log_list = [ u'添加游戏角色', u"post", add_role_url, str(post_data), time, status_code, info ] # 单条日志记录 # GetReport().get_report() # 生成或打开日志文件 # GetReport().record_into_report(log_list) # 逐条写入日志 if __name__ == "__main__": users = Register().register_user() roles = [] for i in range(1, 2101): role = "角色" + str(i) + "#" + str(i).zfill(5) roles.append(role) for user in range(1230, len(users)): login = Login().login(users[user], "aaaaaa") print(login) r = AddRole() print(roles[user]) print(r.add_role(login, 1, roles[user]))