import warnings warnings.filterwarnings('ignore') from apscheduler.schedulers.blocking import BlockingScheduler from sync_amz_data.public import sp_api_client def func_run(): days = -4 for d_ in (-2,-3,-4,-5): try: sp_api_client.SpApiRequest.get_allShops("GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA",days=d_,**{}) except Exception as e: print(e) try: sp_api_client.SpApiRequest.get_allShops("GET_FLAT_FILE_RETURNS_DATA_BY_RETURN_DATE",days=d_,**{}) except Exception as e: print(e) try: sp_api_client.SpApiRequest.get_allShops("GET_SELLER_FEEDBACK_DATA",days=d_,**{}) except Exception as e: print(e) try: sp_api_client.SpApiRequest.get_allShops("GET_FLAT_FILE_OPEN_LISTINGS_DATA",days=-2,**{}) except Exception as e: print(e) try: 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) print("-"*40) try: sp_api_client.SpApiRequest.get_allShops("GET_FLAT_FILE_OPEN_LISTINGS_DATA") except Exception as e: print(e) print("="*40) try: sp_api_client.SpApiRequest.listing_infoTable() except Exception as e: print(e) # func_run() # if __name__ == '__main__': sched = BlockingScheduler() sched.add_job(func_run,'cron',hour=18,minute=0,second=0) sched.start()