def login(): loginUrl = api_url + ApiAuthUser.api() print("===============================") print("login: "******"===============================") respons = requests.post(loginUrl, headers=ApiAuthUser.headers(), data=ApiAuthUser.data(uuid, server_version)) if debug_log == True: print("-------------") print("loginUrl: " + loginUrl) data = dump.dump_all(respons) print(data.decode('utf-8')) print("-------------") print(loginUrl + " status: " + str(respons.status_code)) if respons.status_code != 200: sys.exit("respons.status_code: " + str(respons.status_code)) SecureUtil.updateCookie(respons.headers) return SecureUtil.updateSession(respons.text)
def data(uuid, version): dst_json = user_json.replace('REPLACE_APIVERSION', version) auth_user_dict = json.loads(dst_json) auth_user_text = SecureUtil.createhaders(auth_user_dict, uuid) csum_ans = SecureUtil.csum(auth_user_text + uuid) auth_user_data = 'request={0}&csum={1}&ott=0'.format( auth_user_text, csum_ans) return auth_user_data
def headers(session): user_headers = SecureUtil.basehaders() user_headers['Cookie'] = "; PQDMSESSID=" + session if len(SecureUtil.cookie_awselb_value): user_headers['Cookie'] += "; " + SecureUtil.cookie_awselb_key + "=" + \ SecureUtil.cookie_awselb_value return user_headers
def data(uuid, ott, mtype, tab_id, version): dst_json = user_json.replace('REPLACE_APIVERSION', version) auth_user_dict = json.loads(dst_json) hash = [] item = {"type": mtype.value, "hash": "", "timing": 0, "tag_id": tab_id} hash.append(item) auth_user_dict["hash"] = hash """ for emasterdata in emasterdata_server: item = {"type": emasterdata.value , "hash": "", "timing": 0, "tag_id": 0} hash.append(item) auth_user_dict["hash"] = hash """ auth_user_text = SecureUtil.createhaders(auth_user_dict) csum_ans = SecureUtil.csum(auth_user_text + uuid) auth_user_data = 'request={0}&csum={1}&ott={2}'.format( auth_user_text, csum_ans, ott) return auth_user_data
def headers(session): user_headers = SecureUtil.basehaders() user_headers['Cookie'] = "; PQDMSESSID=" + session return user_headers
def headers(): user_headers = SecureUtil.basehaders() if isinstance(user_headers.get('Cookie'), type(None)) == False: del user_headers['Cookie'] return user_headers
headers=ApiAuthUser.headers(), data=ApiAuthUser.data(uuid, server_version)) if debug_log == True: print("-------------") print("loginUrl: " + loginUrl) data = dump.dump_all(respons) print(data.decode('utf-8')) print("-------------") print(loginUrl + " status: " + str(respons.status_code)) if respons.status_code != 200: sys.exit("respons.status_code: " + str(respons.status_code)) pqdmsessid, ott = SecureUtil.updateSession(respons.text) # getmaster2 debugGetMasterSchemaURl = api_url + ApiGetSchema.api() print("GetSchema: " + debugGetMasterSchemaURl) # スキーマの取得 respons = requests.post(debugGetMasterSchemaURl, headers=ApiGetSchema.headers(pqdmsessid), data=ApiGetSchema.data(uuid, str(ott), server_version)) if debug_log == True: print("-------------") data = dump.dump_all(respons) print(data.decode('utf-8')) print("-------------")