Skip to content

Commit

Permalink
feat: add the code for generating the google pickle string (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
CalvinRodo authored Dec 6, 2023
1 parent 2ad741a commit ca654bb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,7 @@ token.json
auto.tfvars
*.db

geodb
geodb


credentials.json
19 changes: 19 additions & 0 deletions scripts/google_pickle_string/get_google_pickle_string.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import base64
import pickle
from google_auth_oauthlib.flow import InstalledAppFlow

SCOPES = [
"https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/docs",
"https://www.googleapis.com/auth/spreadsheets",
]
def main():
flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES)
creds = flow.run_local_server(port=8081)
if not creds or not creds.valid:
print("There is issue with credentials. Please check.")
exit(0)
print("\n\nCopy pickle string which is present in single quotes and save. Paste it during installation GWorkspace Function App:\n\n{}".format(base64.b64encode(pickle.dumps(creds))))

if __name__ == '__main__':
main()
4 changes: 4 additions & 0 deletions scripts/google_pickle_string/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

google-api-python-client
google-auth-httplib2
google-auth-oauthlib

0 comments on commit ca654bb

Please sign in to comment.