Gmail API and Pythonista
Now that the Gmail API is released it seemed to me to be a good way to further break down the barriers between Pythonista and the outside world.
I have previously used the imbox project within Pythonista with great success as a means of reading and writing structured data from emails.
I wonder, has anyone managed to get the Gmail API working? It seems to me to be a promising and convenient step forward. I have tried the following:
- I loaded the Python API client library into a Pythonista project
- I registered a project on the Google Developers' Console, created credentials, and downloaded the relevant JSON creds data to the project
- I ran the sample script on the quickstart page
- I encountered an error relating to gflags -- so I downloaded and incorporated that library.
At this stage the sample script crashes with an error that contains no clue as to what is missing (at least to one who is not familiar with what gflags is doing).
Hence this post: has anyone got it working?
quickstart.pyattempts to open a web site (
https://accounts.google.com...). A new tab opens in Console to get to the web site, but I get an error:
403. That's an error. Error: disallowed_useragent Google can't sign you in safely inside this app. You can use Google sign-in by visiting this app’s website in a browser like Safari or Chrome.
Is there a way to fix this so that the web site can open from within Pythonista?
@midas9087, you can allow ”unsafe browsers” from Google settings, if I recall correctly. Unsafeness had maybe something to with SSL/TLS versions.
I already allowed unsafe browsers on my Google account (via Google settings).
It is a user agent thing. Webvuews are not allowed to use the auth, since the containing app could steal your login info. They want you using the actual objc api's.
You can get around this, i think by changing the user agent. There was a thread recently on that topic. You would have to modify the quickstart script to use a modified webview.