Skip to main content

Programmatically upload files to kDrive drop boxes

Project description

kDrive Uploader

A small tool to programmatically upload files to kDrive drop boxes, used by the author as a poor man's backup solution.

Quickstart

First install with pip then run:

pip install kdrive-uploader

# upload all files in current folder
kdrive-uploader 0000000/00000000-0000-0000-0000-000000000000

# upload a specific file
kdrive-uploader 0000000/00000000-0000-0000-0000-000000000000 README.md

The link can either be just the last part containing the ids as above or a full kDrive drop box link (in the shape https://kdrive.infomaniak.com/app/collaborate/0000000/00000000-0000-0000-0000-000000000000).

You can also run it directly using uv:

uvx kdrive-uploader --help

Or with docker (still using uv):

docker run --rm --workdir /io -v .:/io -v uv-cache:/root/ ghcr.io/astral-sh/uv:alpine uvx kdrive-uploader --help

More info

A state database (.kdu_state.sqlite3) at the root of the backed-up directory tracks each file's hash. Only new or changed files are uploaded on each run. The root is the closest parent directory that already contains a state database, or the target directory itself if none is found.

This works best for append-only cases, since kDrive drop boxes are write-only. Updates are still handled by kDrive, which creates a duplicate with (1) appended to the filename. Being write-only and append-only prevents an attacker who takes control of the server from compromising the backup.

Losing the state database would result in a full re-upload and duplicates. In such scenarios, the easiest fix is to clear the drop box first. In the future, a --fake argument could allow generating an initial state database from a local kDrive copy, which could then be deployed to the server to avoid a full re-upload.

Manual

Usage: kdrive-uploader [OPTIONS] LINK [PATH]

╭─ Arguments ────────────────────────────────────────────────────────────────────────────────────────╮
│ *    link      TEXT    [required]                                                                  │
│      path      [PATH]  [default: .]                                                                │
╰────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────╮
│ --first-name                    TEXT  [default: kdrive]                                            │
│ --last-name                     TEXT  [default: uploader]                                          │
│ --email                         TEXT  [default: kdrive-uploader@ik.me]                             │
│ --dry-run       --no-dry-run          [default: no-dry-run]                                        │
│ --help                                Show this message and exit.                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────╯

Dev quickstart

# create dev env
uv sync --dev

# install prek (git hooks manager)
uv run prek install

# run from source
cd test_data
uv run kdrive-uploader 0000000/00000000-0000-0000-0000-000000000000

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

kdrive_uploader-0.1.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

kdrive_uploader-0.1.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file kdrive_uploader-0.1.1.tar.gz.

File metadata

  • Download URL: kdrive_uploader-0.1.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kdrive_uploader-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e45861f461cc8cac5c8f5fb42eb8f27b796100a025f8960d572c9b1cb3a6b684
MD5 f26ee060b622356728c3eaa745e51431
BLAKE2b-256 b7970c5b241827ebe72f157a3c9ec7efee499eaab620db45426182ec008c1a2e

See more details on using hashes here.

File details

Details for the file kdrive_uploader-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: kdrive_uploader-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kdrive_uploader-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 be3d5e99914bffcb078850bce46bbc13067947f357e0754974ae7cb47d67ca0a
MD5 26a327941b1bd6f23f00110b9ea9440a
BLAKE2b-256 277537501e0b01c6b2914a769f8060c5baf0cb520d85d5f74bae99bd39318f55

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