Untitled
unknown
plain_text
2 years ago
1.9 kB
2
Indexable
Never
import datetime from random import randrange import google_sheets import google_client import time import schedule # from schedule import repeat, every # https://developers.google.com/oauthplayground/ # рустам нахушев - на сердце рана # шамхан далдаев - кавказ # git rm --cached -r <directory_to_remove> ### to add .gitignore and disable tracking that file def insert_data(): for i in range(3,0,-1): date_yesterday = (datetime.date.today()-datetime.timedelta(days=i)).strftime("%Y-%m-%d") date_to_update_pendings = (datetime.date.today()-datetime.timedelta(days=8)).strftime("%Y-%m-%d") google_sheets.insert_brocard_data(date_yesterday) print('Brocard inserted, date:', date_yesterday) google_sheets.insert_glory_data(date_yesterday) print('Glory inserted') google_sheets.update_pendings_data(date_to_update_pendings) print('Holds updated') print('________________________________________________________________________') def update_data(): for i in range(14, 3, -1): date_to_update_pendings = (datetime.date.today()-datetime.timedelta(days=i)).strftime("%Y-%m-%d") print(f'Date to update holds: {date_to_update_pendings}') google_sheets.update_pendings_data(date_to_update_pendings) print('Holds updated') print('________________________________________________________________________') def main(): google_client.google_oauth() # time.sleep(4) insert_data() # update_data() schedule.every(50).minutes.do(google_client.google_oauth) time.sleep(15) schedule.every().day.at("09:30").do(insert_data) schedule.every().day.at("18:30").do(update_data) while True: schedule.run_pending() time.sleep(1) if __name__ == '__main__': main()