Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorization of own account for django app #338

Open
GoogleCodeExporter opened this issue May 13, 2015 · 0 comments
Open

Authorization of own account for django app #338

GoogleCodeExporter opened this issue May 13, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

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

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

No branches or pull requests

1 participant