I'm having trouble doing just about anything in OAuth2 using Python. I've gone through about 20 different iterations of example code from multiple sites and none of them work. Here is what I have in my file at this very moment but it doesn't compile. Any suggestions? Thanks in advance!
import requests
from requests_oauthlib import OAuth2Session
from requests.auth import HTTPBasicAuth
from oauthlib.oauth2 import BackendApplicationClient
client_id = "xxx"
client_secret = "yyy"
authorization_base_url = 'https://accounts.google.com/o/oauth2/auth'
token_url = 'https://accounts.google.com/o/oauth2/token'
project_id = 'zzz'
redirect_uri = "http://localhost"
client = BackendApplicationClient(client_id=client_id)
oauth = OAuth2Session(client=client)
token = oauth.fetch_token(token_url=token_url, client_id=client_id,
client_secret=client_secret)