Skip to main content

Dropbox-style Python client for the pCloud API.

Project description

pcloud-python-sdk

PyPI version CI

Dropbox-style Python SDK for the pCloud API.

Install

pip install pcloud-python-sdk

Quickstart

from pcloud import PCloud, PCloudOAuth2Flow

# 1) OAuth flow (web) — paste the code back
flow = PCloudOAuth2Flow(app_key, app_secret, redirect_uri, location="EU")
print("Go to:", flow.start(state="xyz"))
code = input("Paste code: ").strip()
token = flow.finish(code)

# 2) Use the client
pc = PCloud(access_token=token.access_token)
print(pc.files.list_folder(folderid=0))

Upload with progress

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

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

python -m pip install -U pip
pip install -e .
pip install pytest ruff mypy
pytest -q

Releasing

  • Create a PyPI project & token.
  • Locally:
    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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pcloud_python_sdk-1.0.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pcloud_python_sdk-1.0.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file pcloud_python_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: pcloud_python_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.6

File hashes

Hashes for pcloud_python_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 345a133908a983f32e79e1169a2df1d3722dfec1947f799f5347da7cac073e65
MD5 ac54e6a66dbab45fac243621d64599cb
BLAKE2b-256 801c6761d95e548f7f94c53f27d501f39e31444a4addaf09ff531b3460840bfd

See more details on using hashes here.

File details

Details for the file pcloud_python_sdk-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pcloud_python_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1305d38159fcd88c25889133b1b7fd973ae17321daf4f8288f6766c0740292ac
MD5 abb3de699aa798fd74eb12f69ef52911
BLAKE2b-256 e5d00e5aedabecbd874ded88ee831e5c121217a4fe66f35d613a126237ab9c32

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page