Metadata-Version: 2.4
Name: pcloud-python-sdk
Version: 1.0.3
Summary: Python client for the pCloud API.
Project-URL: Homepage, https://github.com/you/pcloud-python-sdk
Project-URL: Issues, https://github.com/you/pcloud-python-sdk/issues
Author: Your Name
License: MIT License
        
        Copyright (c) 2025
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: cloud-storage,dropbox-style,pcloud,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: requests<3,>=2.28
Description-Content-Type: text/markdown

# pcloud-python-sdk

[![PyPI version](https://img.shields.io/pypi/v/pcloud-python-sdk.svg)](https://pypi.org/project/pcloud-python-sdk/)
![CI](https://github.com/you/pcloud-python-sdk/actions/workflows/ci.yml/badge.svg)

Dropbox-style Python SDK for the pCloud API.

## Install
```bash
pip install pcloud-python-sdk
```

## Quickstart
```python
from pcloud import PCloud, PCloudOAuth2Flow

# 1) OAuth flow (web) — paste the code back
flow = PCloudOAuth2Flow(app_key, app_secret,
                        redirect_uri=None,  # EXACT match
                        location="EU")

auth_url = flow.start(state="xyz")
print("Open:", auth_url)  # sanity check the redirect_uri value shown

code = input("Paste the code from the URL bar: ").strip()
tok = flow.finish(code)

pc = PCloud(access_token=tok.access_token, location="EU")
print(pc.files.list_folder(folderid=0))
```

## Upload with progress
```python
from pcloud import PCloud
pc = PCloud(access_token="...")

def on_progress(done, total):
    if total:
        pct = 100.0 * done / total
        print(f"Uploaded {done}/{total} bytes ({pct:.1f}%)")
    else:
        print(f"Uploaded {done} bytes")

pc.files.files_upload("local.jpg", folderid=0, on_progress=on_progress)
```

## Download with progress
```python
from pcloud import PCloud
pc = PCloud(access_token="...")

def on_progress(done, total):
    if total:
        pct = 100.0 * done / total
        print(f"Downloaded {done}/{total} bytes ({pct:.1f}%)")
    else:
        print(f"Downloaded {done} bytes")

pc.files.files_download(fileid=12345, dest_path="./local.jpg", on_progress=on_progress)
```

## API surface
- `pcloud.PCloud`: top-level client
- `pcloud.PCloudOAuth2Flow` / `pcloud.PCloudOAuth2FlowNoRedirect`: OAuth helpers
- `client.files.*`:
  - `list_folder`, `create_folder`, `delete_file`
  - `files_upload`, `files_download`, `get_file_link`

This mirrors the ergonomics of the Dropbox Python SDK while using pCloud endpoints under the hood.

## Development
```bash
python -m pip install -U pip
pip install -e .
pip install pytest ruff mypy
pytest -q
```

## Releasing
- Create a PyPI project & token.
- Locally:
  ```bash
  python -m pip install -U build twine
  python -m build
  twine check dist/*
  twine upload dist/*
  ```
- Or tag `vX.Y.Z` and let GitHub Actions publish (see `.github/workflows/release.yml`).

## License
MIT
