sync_listing_order_Retry.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import warnings
  2. warnings.filterwarnings('ignore')
  3. from apscheduler.schedulers.blocking import BlockingScheduler
  4. from sync_amz_data.public import sp_api_client
  5. def func_run():
  6. days = -4
  7. try:
  8. sp_api_client.SpApiRequest.get_allShops("GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL",days=days,**{})
  9. except Exception as e:
  10. print(e)
  11. try:
  12. sp_api_client.SpApiRequest.get_allShops("GET_FLAT_FILE_RETURNS_DATA_BY_RETURN_DATE",days=-2,**{})
  13. except Exception as e:
  14. print(e)
  15. try:
  16. sp_api_client.SpApiRequest.get_allShops("GET_SELLER_FEEDBACK_DATA",days=-2,**{})
  17. except Exception as e:
  18. print(e)
  19. try:
  20. sp_api_client.SpApiRequest.get_allShops("GET_FLAT_FILE_OPEN_LISTINGS_DATA",days=-2,**{})
  21. except Exception as e:
  22. print(e)
  23. try:
  24. sp_api_client.SpApiRequest.get_allShops("GET_SALES_AND_TRAFFIC_REPORT",days=days,**{"level":"SKU"})
  25. sp_api_client.SpApiRequest.get_allShops("GET_SALES_AND_TRAFFIC_REPORT",days=days,**{"level":"PARENT"})
  26. sp_api_client.SpApiRequest.get_allShops("GET_SALES_AND_TRAFFIC_REPORT",days=days,**{"level":"CHILD"})
  27. except Exception as e:
  28. print(e)
  29. print("-"*40)
  30. try:
  31. sp_api_client.SpApiRequest.get_allShops("GET_FLAT_FILE_OPEN_LISTINGS_DATA")
  32. except Exception as e:
  33. print(e)
  34. print("="*40)
  35. try:
  36. sp_api_client.SpApiRequest.listing_infoTable()
  37. except Exception as e:
  38. print(e)
  39. # func_run()
  40. #
  41. if __name__ == '__main__':
  42. sched = BlockingScheduler()
  43. sched.add_job(func_run,'cron',hour=18,minute=0,second=0)
  44. sched.start()