api_test.py 1.3 KB

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