Hi!
I'm trying to implement 'Server to Server' OAuth authentication in my Python 3.4 application to work with Google Cloud Storage. So, in general it is described on this page Using OAuth 2.0 for Server to Server Applications
But there's an error while I'm running my script:
Traceback (most recent call last):
File "my_script.py", line 4, in from oauth2client.service_account import ServiceAccountCredentials
File "/usr/local/lib/python3.4/dist-packages/oauth2client/service_account.py", line 31, in from oauth2client.client import SERVICE_ACCOUNTImportError: cannot import name 'SERVICE_ACCOUNT'
So, here's my code:
from apiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
from httplib2 import Http
scopes = ['https://www.googleapis.com/auth/cloud-platform.read-only']
credentials = ServiceAccountCredentials.from_json_keyfile_name('./keyfile.json', scopes)
http_auth = credentials.authorize(Http())
service = build('storage', 'v1', http=http_auth)
If you would be so kind to help me with it, it would be great! It's the one of my first scripts on a Python language, and I'm a newbie both in Python and in Linux worlds, so I can miss something very obvious.
If it is important, my OS is Ubuntu 12.04.
Thanks!