def delete_medcines(medcine_id): ret1, session_id = login.login_system("byhy", "88888888") cookies = dict(sessionid=session_id) payload = {"action": "del_medicine", "id": medcine_id} response = requests.delete(medcine_url, json=payload, cookies=cookies, proxies=proxies) ret = response.json() pprint(ret) return ret
def delete_customers(customer_id): ret1, session_id = login.login_system("byhy", "88888888") cookies = dict(sessionid=session_id) payload = { "action":"del_customer", "id": customer_id } response = requests.delete(customer_url, json=payload, cookies=cookies, proxies=proxies) pprint(response.text) ret = response.json() pprint(ret) return ret
def add_medcines(name, desc, sn): ret1, session_id = login.login_system("byhy", "88888888") cookies = dict(sessionid=session_id) payload = { "action": "add_medicine", "data": { "name": name, "desc": desc, "sn": sn } } response = requests.post(medcine_url, json=payload, cookies=cookies, proxies=proxies) ret = response.json() pprint(ret) return ret
def add_orders(name, customer_id, medcine_list): ret1, session_id = login.login_system("byhy", "88888888") cookies = dict(sessionid=session_id) payload = { "action": "add_order", "data": { "name": name, "customerid": customer_id, "medicinelist": medcine_list } } response = requests.post(order_url, json=payload, cookies=cookies, proxies=proxies) ret = response.json() pprint(ret) return ret
def list_medcines(): ret1, session_id = login.login_system("byhy", "88888888") cookies = dict(sessionid=session_id) payload = { "action": "list_medicine", "pagesize": 10, "pagenum": 1, "keywords": "" } response = requests.get(medcine_url, params=payload, cookies=cookies, proxies=proxies) ret = response.json() pprint(ret) return ret
def edit_customers(customer_id, new_name, new_phonenumber, new_address): ret1, session_id = login.login_system("byhy", "88888888") # pprint(ret1) # pprint(session_id) cookies = dict(sessionid=session_id) payload = { "action": "modify_customer", "id": customer_id, "newdata": { "name": new_name, "phonenumber": new_phonenumber, "address": new_address } } response = requests.put(customer_url, json=payload, cookies=cookies, proxies=proxies) ret = response.json() pprint(ret) return ret
def edit_medcine(medcine_id, new_name, new_desc, new_sn): ret1, session_id = login.login_system("byhy", "88888888") # pprint(ret1) # pprint(session_id) cookies = dict(sessionid=session_id) payload = { "action": "modify_medicine", "id": medcine_id, "newdata": { "name": new_name, "desc": new_desc, "sn": new_sn } } response = requests.put(medcine_url, json=payload, cookies=cookies, proxies=proxies) ret = response.json() pprint(ret) return ret