This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, json | |
# Get refresh token from google drive api | |
# Generating a refresh token for DRIVE API calls using the OAuth playground | |
# https://www.youtube.com/watch?v=hfWe1gPCnzc | |
def getToken(): | |
oauth = 'https://www.googleapis.com/oauth2/v4/token' # Google API oauth url | |
headers = {'content-type': 'application/x-www-form-urlencoded'} | |
data = { | |
'grant_type': 'refresh_token', |
When running FastAPI
app, all the logs in console are from Uvicorn
and they do not have timestamp and other useful information. As Uvicorn
applies python logging
module, we can override Uvicorn
logging formatter by applying a new logging configuration.
Meanwhile, it's able to unify the your endpoints logging with the Uvicorn
logging by configuring all of them in the config file log_conf.yaml
.
Before overriding:
uvicorn main:app --reload