priyadarshy / google-calendar-v3

Google Calendar V3 Python Client
Apache License 2.0
6 stars 1 forks source link

How to get YOUR_ACCESS_TOKEN , YOUR_REFRESH_TOKEN? #3

Open skanel opened 9 years ago

skanel commented 9 years ago
# Import the GoogleCalendarAPI Class.
from google_calendar_v3 import GoogleCalendarAPI

# Define a token handler for use on token refresh.
def new_token_handler(token):
    # Do something with your token. Like stick it in a db.
    print "A new token arrived: "
    print token

# Enter in your various credentials here.
access_token = "<YOUR_ACCESS_TOKEN>"
refresh_token = "<YOUR_REFRESH_TOKEN>"
client_id = "902453498010-ubvvvk714bada1o9tog10i3n5fq7cqm.apps.googleusercontent.com"
client_secret = "jK_7QqIZlcxzk-WuLo8Kyc9-"

# Create an instance of the Google Calendar API.
gapi = GoogleCalendarAPI(client_id=client_id, client_secret=client_secret,
             acc_token=access_token, ref_token=refresh_token, expires_in=-30,
             token_updater=new_token_handler)

# Do something with it.
r  = gapi.settings_list("dateFieldOrder")
print t.text
jkatz50 commented 9 years ago

not an issue - register with google api console

https://code.google.com/apis/console/b/0/

skanel commented 9 years ago

thanks