- Create application and take its id and secret.
- Make a GET request to send secret and id with needed scopes of access.
- Obtain TEMPORARY access token and refresh token (first lives about 3000 – 5000 sec, the second can probably live infinite)
- Use this access token to GET something through REST, check if this token is not expires already.
- You want to GET something ELSE? First check if your token is not expired, then if expired – use refresh token to get NEW TEMPORARY token.
- Do something else.
Nice turn google! You are the best of masters of creating shitcode.
Before starting real work on google API and my own project with Google Drive I’ll learn pythons “requests” perfectly, first!
Thanks google you will make me smarter!
Example of shitcode which is needed to get the token first, then check if it is not expired and then request NEW if old was expired already.
It now is not working as expected, just some drafts. I’ve used this guy example: https://gist.github.com/SalvaJ/9722045 and Google Drive starter: https://developers.google.com/drive/v2/web/quickstart/python
What I want to do is to use python’s requests module to clear this shit out of code and make automation token renewal process.
But just one problem I can’t handle even in plans – is to make generation of this token from steps 2,3 – automate, because google wants me, as user, to click an “Agree” button right in browser, and there is no way to automate it without some way of shitcode and pseudo-browsers.