1234567891011121314151617181920212223242526272829 |
- import warnings
- warnings.filterwarnings('ignore')
- from apscheduler.schedulers.blocking import BlockingScheduler
- from sync_amz_data.public import sp_api_client
- def func_run():
- try:
- for days in (-2,-3,-4):
- sp_api_client.SpApiRequest.get_allShops("GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_GENERAL",days=days,**{})
- except Exception as e:
- print(e)
- try:
- for days in range(-2,-3,-4):
- sp_api_client.SpApiRequest.get_allShops("GET_SALES_AND_TRAFFIC_REPORT",days=days,**{"level":"SKU"})
- sp_api_client.SpApiRequest.get_allShops("GET_SALES_AND_TRAFFIC_REPORT",days=days,**{"level":"PARENT"})
- sp_api_client.SpApiRequest.get_allShops("GET_SALES_AND_TRAFFIC_REPORT",days=days,**{"level":"CHILD"})
- except Exception as e:
- print(e)
- # func_run()
- if __name__ == '__main__':
- sched = BlockingScheduler()
- sched.add_job(func_run, 'cron', hour=0, minute=0,
- second=30)
- sched.start()
|