oauth2client

gmail api gives failedPrecondition error

烈酒焚心 提交于 2019-12-01 00:08:41
I can't get gmail api to work. I'm using server-to-server authentication with JWT. google-api-python-client==1.4.0 httplib2==0.9 oauth2client==1.4.7 pycrypto==2.6.1 My code looks like this. with open(CLIENT_SECRET_FILE) as f: data = json.loads(f.read()) private_key = data['private_key'] client_email = data['client_email'] credentials = SignedJwtAssertionCredentials(client_email, private_key, scope=OAUTH_SCOPE) http = credentials.authorize(http) gmail_service = build('gmail', 'v1', http=http) try: threads = gmail_service.users().messages().list(userId='me').execute() except Exception as e:

How do I use google.auth instead of oauth2client in Python to get access to my Google Calendar

余生颓废 提交于 2019-11-29 22:07:39
问题 Several years ago I created a small Python program which were able to maintain my calendar using oauth2client which is now deprecated and replaced with google.auth - but I cannot find any useful documentation and my program stopped working complaining about a _module KeyError which nobody appear to have solved except by upgrading. I cannot figure out how to replace the oauth2client with google.auth: import datetime import httplib2 import os from apiclient import discovery import oauth2client

PyCrypto Errors with .p12 file from Google Developer Console

寵の児 提交于 2019-11-29 02:39:06
I am trying to implement Google Identity Toolkit (gitkitv3) in GAE Python. After a user signs in on the website, I get the following errors: 'PKCS12 format is not supported by the PyCrpto library. ' NotImplementedError: PKCS12 format is not supported by the PyCrpto library. Try converting to a "PEM" (openssl pkcs12 -in xxxxx.p12 -nodes -nocerts > privatekey.pem) or using PyOpenSSL if native code is an option. Based on a SO reply , I ran the following commands on my x.p12 file and used the generated privatekey.pem file instead: openssl pkcs12 -passin pass:notasecret -in x.p12 -nocerts -passout

PyCrypto Errors with .p12 file from Google Developer Console

时间秒杀一切 提交于 2019-11-27 16:59:23
问题 I am trying to implement Google Identity Toolkit (gitkitv3) in GAE Python. After a user signs in on the website, I get the following errors: 'PKCS12 format is not supported by the PyCrpto library. ' NotImplementedError: PKCS12 format is not supported by the PyCrpto library. Try converting to a "PEM" (openssl pkcs12 -in xxxxx.p12 -nodes -nocerts > privatekey.pem) or using PyOpenSSL if native code is an option. Based on a SO reply, I ran the following commands on my x.p12 file and used the

How to get Google Analytics credentials without gflags - using run_flow() instead?

白昼怎懂夜的黑 提交于 2019-11-26 20:54:43
问题 This may take a second to explain so please bear with me: I'm working on a project for work that requires me to pull in google analytics data. I originally did this following this link, so after installing the API client pip install --upgrade google-api-python-client and setting things up like the client_secrets.json , it wanted gflags to be installed in order to execute the run() statement. (i.e credentials = run(FLOW, storage) ) Now, I was getting the error message to install gflags or