edwh-gokapi-plugin
edwh plugin to share files via Gokapi (gokapi.edwh.nl by default).
The commands mirror those of edwh-files-plugin.
Table of Contents
Installation
pip install edwh-gokapi-plugin
Or inject it into an existing uvenv installation of edwh:
uvenv inject edwh edwh-gokapi-plugin
Requires Gokapi 2.0 or newer on the server.
Configuration
Most commands need a Gokapi API key. Create one in the Gokapi admin interface (/apiKeys) with the permissions
you need (upload, view, download, delete) and store it with:
edwh gokapi.login [--server <url>] [--new]
The key is stored as GOKAPI_API_KEY in ~/.config/edwh/.env. A non-default server is stored as GOKAPI_SERVER.
Both can also be set as environment variables, which take precedence over the file.
Usage
(Arguments between < > are required, arguments between [ ] are optional)
Every command accepts --server [str] to use another Gokapi instance than the configured one.
Wherever a file is expected, both its id (oNleRD3pUZgaDKn) and its download url
(https://gokapi.edwh.nl/d?id=oNleRD3pUZgaDKn) work.
Upload
edwh gokapi.upload <path> --max-downloads [int] --max-days [int] --password [str] --rename [str] --compression [str] --compression-level [int]
path: which file or directory to uploadmax-downloads: how often can the file be downloaded? (server default: 1,0= unlimited)max-days: for how long can the file be downloaded? (server default: 14,0= unlimited)password: password required to download the file via its public url. Note: unlikefile.upload --encrypt, the file itself is not encrypted.rename: upload with a different filenamecompression:auto(default),gzip,zipornone. Files are uploaded as-is unless a method is chosen; directories are always archived (autotries pigz, gzip, then zip;nonecreates a plain.tar).compression-level: 1 (fastest) - 9 (smallest)
Files are uploaded in chunks (like the Gokapi web interface does), so large files also work behind a reverse proxy
that limits the request size.
This command outputs the same JSON as file.upload: the status code, download url, the value to delete it with (the
file id) and the commands to download or delete it.
Download
edwh gokapi.download <id_or_url> --output-file [str] --unpack
id_or_url: file id or download url fromgokapi.uploadorgokapi.listoutput-file: where to store the download (default: original filename in the current directory)unpack: unpack the archive, removing it afterwards
With an API key the file is downloaded via the API, which counts towards --max-downloads.
Without one, the public url is used, which only works for files without a password.
Delete
edwh gokapi.delete <id_or_url> --delay [int] --quiet
delay: wait this many seconds before actually deleting the file
List
edwh gokapi.list [--json]
Shows all files that are currently available, with their id, size, remaining downloads, expiry and url.
Use --json for the complete file metadata as a JSON array, sorted by upload date. An empty list is output as [].
Temporary upload
edwh gokapi.tmp <path> --password [str] --compression [str] --compression-level [int]
Uploads a file (max 2 downloads, 1 day) and deletes it as soon as you press enter or ctrl-c.
Unpack
edwh gokapi.unpack <filename> --remove
Development
uv venv venv && source venv/bin/activate
uv pip install -e .[dev]
edwh test.run # pytest with coverage; tests/test_compression.py is slow (1GB files)
edwh fmt lint
Releases are made with vommit, configured under [tool.vommit] in pyproject.toml.
License
edwh-gokapi-plugin is distributed under the terms of the MIT license.
Metadata
Release files for edwh-gokapi-plugin 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| edwh_gokapi_plugin-0.1.0.tar.gz | 16.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| edwh_gokapi_plugin-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.7 kB
Release files / edwh_gokapi_plugin-0.1.0.tar.gz
| Download URL | edwh_gokapi_plugin-0.1.0.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b595dd38e217218fb7c6a7fecabc0b9786e20103fd538474d0a9f9b50e2ff23e
|
|
BLAKE2b-256 checksum How to use checksums |
37d74f5f06e2541254eba7b4e3eb34dea65183c9a287b418b0369ab9234900fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / edwh_gokapi_plugin-0.1.0-py3-none-any.whl
| Download URL | edwh_gokapi_plugin-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
900095ca66d8f5647ba81b0a4db06875175f3939dab2ddc3af55a844fc646229
|
|
BLAKE2b-256 checksum How to use checksums |
195f0a03db249541374112beecbdb6e7a0537af5dd5b2f999310e9c8d633d70a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|