This project shows how to authenticate and upload files to Google Drive using OAuth credentials.
- Create python env and activate
python3 -m venv .genv
source .genv/bin/activate
pip install google-auth google-auth-oauthlib google-auth-httplib2 google-api-python-client
-
Create client secret on Google doc and copy to
client-secret.json -
Run the auth.py Python file to authenticate.
-
python auth.py -
Copy generated link and authenticate with Google.
-
Copy resulting link back to terminal and use to autheticate.
-
Update the todos in
upload.pyand run the file to upload#TODO update file to upload and the folder id FILE_TO_UPLOAD = 'example.zip' #can be path to file REMOTE_FILE_NAME='example.zip' #how to name file on google drive FOLDER_ID = '1P_FXOvPvdSAn4_Ho7Qxxxxx' # Gotten from Google drive url of folder
python upload.py
Read full medium article on project here