https://github.com/constracti/upload-to-google-drive
Upload a file to Google Drive using Python.
https://github.com/constracti/upload-to-google-drive
google-drive google-drive-api oauth2 python3
Last synced: 4 months ago
JSON representation
Upload a file to Google Drive using Python.
- Host: GitHub
- URL: https://github.com/constracti/upload-to-google-drive
- Owner: constracti
- Created: 2021-10-22T10:26:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-03-16T00:14:33.000Z (over 2 years ago)
- Last Synced: 2024-03-16T01:26:54.970Z (over 2 years ago)
- Topics: google-drive, google-drive-api, oauth2, python3
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Upload to Google Drive
Upload a file to Google Drive using Python.
## Dependencies
- **Python 3**
- **Requests** project
```
python3 -m pip install requests
```
## Installation
Download Python source files or clone this repository.
Navigate to https://console.cloud.google.com/ and create a new project.
Find and enable **Google Drive API**.
Click on **Create Credentials**.
Select **Google Drive API**.
You will be accessing **User data**.
Add scope **https://www.googleapis.com/auth/drive.file**.
Select **Desktop app** as an **Application type**.
Save your credentials with name **client_secret.json** in the directory of the source files.
## Authentication
Run **auth.py**:
```
python3 auth.py
```
Open the printed URL in a browser and follow the instructions.
## Usage
Run **upload.py**:
```
python3 upload.py [-v] FILE FOLDER_ID
```
where `FILE` is the file to be uploaded
and `FOLDER_ID` is the target folder id in Google Drive.