Spaces:
Sleeping
Sleeping
Update google_function.py
Browse files134 unmodified lines135136137138138139140141142143144145141146147148149150151147152153154155134 unmodified linesdef connetti_google(): load_dotenv() json_variable_str = os.getenv("JSON_GOOGLE") print(json_variable_str) with open("credentials.json", "w") as f: with open("./credentials.json", "w") as f: f.write(json_variable_str) if os.path.exists("./credentials.json"): print('ESISTE') else: print('NON ESISTE') creds = None if os.path.exists("token.json"): if os.path.exists("./token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file("credentials.json", SCOPES) flow = InstalledAppFlow.from_client_secrets_file("./credentials.json", SCOPES) creds = flow.run_local_server(port=0) with open("token.json", "w") as token: token.write(creds.to_json())google_function.py+8-3