api_test.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import requests
  2. import json
  3. url = "http://127.0.0.1:7960/brandcultivation/api/v1/recommend"
  4. payload = {
  5. "city_uuid": "00000000000000000000000011445301",
  6. "product_code": "130133",
  7. "cust_code_list": [],
  8. "cultivacation_id": "10000003",
  9. "limit_cycle_name": "202606W1(06.01-06.07)"
  10. }
  11. headers = {'Content-Type': 'application/json'}
  12. response = requests.post(url, data=json.dumps(payload), headers=headers)
  13. result = response.json()
  14. print(result)
  15. with open("api_test_result.json", "w", encoding="utf-8") as f:
  16. json.dump(result, f, ensure_ascii=False, indent=2)
  17. # url = "http://127.0.0.1:7960/brandcultivation/api/v1/report"
  18. # payload = {
  19. # "cultivacation_id": "10000001",
  20. # }
  21. # headers = {'Content-Type': 'application/json'}
  22. # response = requests.post(url, data=json.dumps(payload), headers=headers)
  23. # print(response.json())
  24. # url = "http://127.0.0.1:7960/brandcultivation/api/v1/eval_report"
  25. # payload = {
  26. # "city_uuid": "00000000000000000000000011445301",
  27. # "product_code": "440298",
  28. # "cultivacation_id": "10000001",
  29. # # "limit_cycle_name": "202502W2(02.10-02.16)"
  30. # "start_time": "2025/2/10",
  31. # "end_time": "2025/2/16"
  32. # }
  33. # headers = {'Content-Type': 'application/json'}
  34. # response = requests.post(url, data=json.dumps(payload), headers=headers)
  35. # print(response.json())