This repository has been archived by the owner on Dec 22, 2023. It is now read-only.
PMI-753: Read Google auth credentials from environment variables #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The implementation is quite similar to how we do this for Piwik token.
Since
Pygsheets
doesn't currently support reading credentials from anin-memory data structure, we have had to implement creating a temporary
credentials file to do the job. We may revisit this later after the
next major release of
Pygsheets
.Also note that, at present,
dotenv
package doesn't support multi-lineenvironment variables properly. Therefore, when running locally, the
environment variable
GOOGLE_AUTH_PRIVATE_KEY
cannot be defined in.env
file and must be defined in the shell. There is a PR currentlyopen on the Github repo of
dotenv
which fixes this behaviour, so we'llrevisit this later.