Skip to content

Authorization of own account for django app #338

Description

@GoogleCodeExporter
I want to access my own google calendar as part of a web application deployed 
in django. To do this I got the credentials for my google account stored in a 
file (called calendar.dat) which is in the same directory as as the views.py 
file being used for the application. Is there a way to use this file to get my 
credentials. Currently the code is:

from oauth2client.file import Storage

import os.path
import httplib2

module_dir = os.path.dirname(__file__)
file_path = os.path.join(module_dir, calendar.dat)
storage = Storage(file_path)
credentials = storage.get

http = httplib2.Http()
http = credentials.authorize(http)

However, this code returns credentials as None, so it doesn't work in views.py. 
It does work however if I put it in a normal python file and just run it in the 
terminal, as opposed to someone visiting the page in a web browser. Is there a 
way to fix this?

Original issue reported on code.google.com by [email protected] on 15 Oct 2014 at 7:28

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions