From e2a4e2df0634dbb9f6cac0797b1063007b6178ca Mon Sep 17 00:00:00 2001 From: Eduardo Garcia Ruiz Date: Mon, 7 Apr 2025 19:49:34 +0200 Subject: [PATCH] move scripts to the scripts directory and adapt Makefile --- Makefile | 6 +++--- google-apis-usage.md | 2 +- init-virtual-env.sh | 6 ------ google_auth.py => scripts/google/authenticate.py | 9 +++------ scripts/{ => release}/release.sh | 0 scripts/{ => release}/utils.sh | 0 6 files changed, 7 insertions(+), 16 deletions(-) delete mode 100755 init-virtual-env.sh rename google_auth.py => scripts/google/authenticate.py (70%) rename scripts/{ => release}/release.sh (100%) rename scripts/{ => release}/utils.sh (100%) diff --git a/Makefile b/Makefile index b24ed72..46b82f5 100644 --- a/Makefile +++ b/Makefile @@ -10,13 +10,13 @@ test: pytest $(ARGS) init-virtual-env: - ./init-virtual-env.sh + ./scripts/venv/init.sh google-auth: - python3 google_auth.py + python3 ./scripts/google/authenticate.py clean: rm -rf build .pytest_cache dist google_drive.egg-info release: - ./scripts/release.sh + ./scripts/release/release.sh diff --git a/google-apis-usage.md b/google-apis-usage.md index 1cf3f04..49917cf 100644 --- a/google-apis-usage.md +++ b/google-apis-usage.md @@ -2,7 +2,7 @@ ## Authentication -We should have a credentials.json file to use for the authentication process. +We should have a `credentials.json` file to use for the authentication process. You could obtain your credentials using [google developer console](https://console.developers.google.com/apis/) Using the same credentials you could specify all scopes you need, e.g: diff --git a/init-virtual-env.sh b/init-virtual-env.sh deleted file mode 100755 index 6e7bd3d..0000000 --- a/init-virtual-env.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -VIRTUAL_ENV_NAME='env' - -python3 -m venv $VIRTUAL_ENV_NAME && source ./$VIRTUAL_ENV_NAME/bin/activate -python3 -m pip install -U pip wheel setuptools diff --git a/google_auth.py b/scripts/google/authenticate.py similarity index 70% rename from google_auth.py rename to scripts/google/authenticate.py index 1a70388..4e7002d 100644 --- a/google_auth.py +++ b/scripts/google/authenticate.py @@ -1,5 +1,6 @@ from __future__ import print_function -from googledrive.api import GoogleAuth + +from googledrive import api # If modifying these scopes, delete the file token.pickle. @@ -7,22 +8,18 @@ # drive: Full, permissive scope to access all of a user's files, # excluding the Application Data folder. "https://www.googleapis.com/auth/drive", - # gmail: Send messages only. No read or modify privileges on mailbox. - "https://www.googleapis.com/auth/gmail.send", # docs: Per-file access to files that the app created or opened. "https://www.googleapis.com/auth/drive.file", # sheets: # Allows read-only access to the user's sheets and their properties. "https://www.googleapis.com/auth/spreadsheets.readonly", - # appscripts: - #'https://www.googleapis.com/auth/script.projects', ] CREDENTIALS = "credentials.json" def main(): - GoogleAuth().authenticate(CREDENTIALS, SCOPES) + api.GoogleAuth().authenticate(CREDENTIALS, SCOPES) print('File "token.pickle" should be generated') diff --git a/scripts/release.sh b/scripts/release/release.sh similarity index 100% rename from scripts/release.sh rename to scripts/release/release.sh diff --git a/scripts/utils.sh b/scripts/release/utils.sh similarity index 100% rename from scripts/utils.sh rename to scripts/release/utils.sh