sync_listing_order_Retry.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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_SALES_AND_TRAFFIC_REPORT",days=days,**{"level":"SKU"})
  13. sp_api_client.SpApiRequest.get_allShops("GET_SALES_AND_TRAFFIC_REPORT",days=days,**{"level":"PARENT"})
  14. sp_api_client.SpApiRequest.get_allShops("GET_SALES_AND_TRAFFIC_REPORT",days=days,**{"level":"CHILD"})
  15. except Exception as e:
  16. print(e)
  17. print("-"*40)
  18. try:
  19. sp_api_client.SpApiRequest.get_allShops("GET_FLAT_FILE_OPEN_LISTINGS_DATA")
  20. except Exception as e:
  21. print(e)
  22. print("="*40)
  23. try:
  24. sp_api_client.SpApiRequest.listing_infoTable()
  25. except Exception as e:
  26. print(e)
  27. # func_run()
  28. #
  29. if __name__ == '__main__':
  30. sched = BlockingScheduler()
  31. sched.add_job(func_run,'cron',hour=18,minute=0,second=0)
  32. sched.start()