Skip to content

Instantly share code, notes, and snippets.

@milancermak
Created August 24, 2012 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milancermak/3451039 to your computer and use it in GitHub Desktop.
Save milancermak/3451039 to your computer and use it in GitHub Desktop.
Example of creating a OAuth2Credentials with dummy access token and a working refresh token
import datetime
import httplib2
from oauth2client.client import OAuth2Credentials
credentials = OAuth2Credentials("irrelevant access token",
"some-random-hash.apps.googleusercontent.com", # Client ID
"your-client-secret",
"refresh-token",
datetime.datetime.now(), # token expiry
"https://accounts.google.com/o/oauth2/token")
http = httplib2.Http()
http = credentials.authorize(http)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment