Metadata-Version: 2.4
Name: eh-gdrive-uploader
Version: 1.0.0
Summary: Cross-platform Google Drive file uploader CLI
Author-email: Esmail Ebrahim Hamza <esmailebraheem771@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/EsmailEbrahim/eh-gdrive-uploader
Project-URL: Documentation, https://github.com/EsmailEbrahim/eh-gdrive-uploader#readme
Project-URL: Repository, https://github.com/EsmailEbrahim/eh-gdrive-uploader.git
Project-URL: Issues, https://github.com/EsmailEbrahim/eh-gdrive-uploader/issues
Project-URL: Changelog, https://github.com/EsmailEbrahim/eh-gdrive-uploader/blob/main/CHANGELOG.md
Keywords: google-drive,upload,cli,backup,cloud-storage
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Archiving :: Backup
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: google-api-python-client>=2.0.0
Requires-Dist: google-auth-httplib2>=0.1.0
Requires-Dist: google-auth-oauthlib>=0.5.0
Provides-Extra: dev
Requires-Dist: flake8>=6.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Requires-Dist: build>=0.10.0; extra == "dev"
Dynamic: license-file

# EH Google Drive Uploader

[![PyPI version](https://badge.fury.io/py/eh-gdrive-uploader.svg)](https://pypi.org/project/eh-gdrive-uploader/)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Cross-platform Python CLI tool to upload files to Google Drive.

By **Esmail Ebrahim Hamza** ([@EsmailEbrahim](https://github.com/EsmailEbrahim))

## Features

- Upload any file type (including large ZIP archives)
- OAuth2 secure authentication (browser login once, reuse token)
- Upload to specific Drive folders
- Rename files on upload
- Cross-platform: Windows, Linux, macOS
- Resumable uploads for reliability

## Installation

### From PyPI (Recommended)
```bash
pip install eh-gdrive-uploader
eh-gdrive-uploader --version
```

### From Source
```bash
git clone https://github.com/EsmailEbrahim/eh-gdrive-uploader.git
cd eh-gdrive-uploader
pip install -e .
```

## Usage

```bash
# Upload file
eh-gdrive-uploader myfile.zip

# Upload to folder
eh-gdrive-uploader myfile.zip -f FOLDER_ID

# Rename
eh-gdrive-uploader myfile.zip -n newname.zip

# List files
eh-gdrive-uploader --list

# Setup help
eh-gdrive-uploader --setup
```

---

## Quick Start

### 1. Clone & Setup Environment
#### From Source (Development)

```bash
# Clone repo
git clone https://github.com/EsmailEbrahim/eh-gdrive-uploader.git
cd eh-gdrive-uploader

# Create virtual environment
python -m venv venv

# Activate (Windows)
venv\Scripts\activate
# Activate (Linux/macOS)
# source venv/bin/activate

# Install in editable mode
pip install -e .

# Verify installation
eh-gdrive-uploader --version
```

### 2. Google Cloud Setup (One-time)

1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Create new project (top-left dropdown)
3. **Enable Google Drive API:**
   - Navigation menu → APIs & Services → Library
   - Search "Google Drive API" → Click **Enable**
4. **Create OAuth Credentials:**
   - APIs & Services → Credentials
   - Click **Create Credentials** → OAuth client ID
   - Application type: **Desktop application**
   - Name: `Drive Uploader`
   - Click **Create** → **Download JSON**
5. **Place credentials:**
   - Copy downloaded file to: `~/.gdrive_uploader/credentials.json`
   - Windows: `C:\Users\YOURNAME\.gdrive_uploader\credentials.json`
   - Ubuntu: `/home/YOURNAME/.gdrive_uploader/credentials.json`

Or run: `python -m eh_gdrive_uploader.gdrive_upload --setup` for detailed instructions.

### 3. First Run (Authentication)

```bash
python -m eh_gdrive_uploader.gdrive_upload myfile.zip
```
Browser will open for Google login → Authorization token saved automatically.

---

## Error: "Access blocked: Test has not completed the Google verification process"

**Solution:**
1. Go to [Google Cloud Console](https://console.cloud.google.com/)
2. Select your project → **APIs & Services** → **OAuth consent screen**
3. Under **Test users**, click **Add users**
4. Add your Gmail address (`YOUREMAIL@gmail.com`)
5. Save and retry the script

---

## Usage

### Basic Upload
```bash
# Upload to Drive root
python -m eh_gdrive_uploader.gdrive_upload backup.zip

# Upload with progress
python -m eh_gdrive_uploader.gdrive_upload "C:\Users\Me\Documents\archive.zip"
```

### Upload to Specific Folder
```bash
# Get folder ID from Drive URL (last part after /folders/)
python -m eh_gdrive_uploader.gdrive_upload backup.zip -f 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms
```

### Rename on Upload
```bash
python -m eh_gdrive_uploader.gdrive_upload backup.zip -n "backup-2026-02-05.zip"
```

### List Recent Files
```bash
python -m eh_gdrive_uploader.gdrive_upload --list
```

### Show Setup Help
```bash
python -m eh_gdrive_uploader.gdrive_upload --setup
```

---

## Environment Management

**Activate environment (Windows):**
```powershell
venv\Scripts\activate
```

**Activate environment (Ubuntu/Linux):**
```bash
source venv/bin/activate
```

**Deactivate (any platform):**
```bash
deactivate
```

---

## Project Structure

```
eh-gdrive-uploader/
├── eh_gdrive_uploader/   # Main package
│   ├── __init__.py       # Package initializer
│   └── gdrive_upload.py  # Main script (CLI entry point)
├── venv/                 # Virtual environment (not in git)
├── .gitignore            # Ignore credentials & cache
├── CHANGELOG.md          # Project changelog
├── LICENSE               # Licens file (MIT)
├── Makefile              # Make commands for setup
├── pyproject.toml        # Python project metadata
├── README.md             # This file
├── requirements.txt      # Python dependencies
└── requirements-dev.txt  # Development dependencies
```

## Version History

See [CHANGELOG.md](CHANGELOG.md) for details.

## Security Notes

- **Never commit `credentials.json` or `token.pickle`** — they are in `.gitignore`
- Tokens stored locally in `~/.gdrive_uploader/` (user home directory)
- First run requires browser authentication; subsequent runs use saved token

## Troubleshooting

| Issue | Solution |
|-------|----------|
| `credentials.json not found` | Run setup step 2, check file is in `~/.gdrive_uploader/` |
| Browser doesn't open | Check default browser; use same machine with GUI |
| `ModuleNotFoundError` | Run `pip install -r requirements.txt` inside venv |
| Token expired | Delete `~/.gdrive_uploader/token.pickle` and re-run |

## Author

**Esmail Ebrahim Hamza**  
- [esmailebraheem771@gmail.com](mailto:esmailebraheem771@gmail.com)
- [GitHub: EsmailEbrahim](https://github.com/EsmailEbrahim)

## License

MIT License - Free for personal and commercial use.
See [LICENSE](LICENSE) for details.
