You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most of the world is on Python 3 today, but there are still some with dependencies on 2.x that make migration challenging. The Python code samples in this repo are both Python 2-3 compatible, hence why you don't see newer features like async-await, type annotations, f-strings, etc.
Prerequisites/required setup
NodeJS(16+): Create a basic package.json and install required pkgs with this command:
npm init -y; npm i googleapis @google-cloud/local-auth
Python 2 or 3(new auth): In your normal or virtualenv environment, run the following command if using the current/new Python auth libraries (most everyone):
Python 2 or 3(old auth): If you have dependencies on the older Python auth libraries and/or still have old code lying around that do (see warning sidebar below), run this command to ensure you have the latest/last versions of these libraries:
For Python specifically, 2.x means 2.7, and if you're already planning the migration to 3.x, you should definitely not be using anything older than 2.6 (as it's the 1st release with 3.x-compatible features). For 3.x, it should work for nearly all releases, but 3.7 or newer are recommend.
💥 Caveat: oauth2client deprecated
The older Python auth libraries, primarily oauth2client, were deprecated in 2017 in favor of modern replacements. However the newer libraries do not support OAuth token storage, hence why the older *-old.py samples are generally always shorter than their modern equivalents. For now, oauth2client still works, even in maintenance mode, and provides automated, threadsafe, and 2.x/3.x-compatible storage of and access to OAuth2 tokens for users whereas the newer libraries do not (yet).