Metadata-Version: 2.1
Name: openzim-uploader
Version: 1.2
Summary: SCP/SFTP helper for openZIM uploads to our dropbox
Home-page: https://github.com/openzim/zimfarm/tree/master/uploader
Author: kiwix
Author-email: reg@kiwix.org
License: GPLv3+
Keywords: scp sftp upload kiwix
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Requires-Python: >=3.6
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Requires-Dist: kiwixstorage (<0.9,>=0.8.3)
Provides-Extra: all
Requires-Dist: humanfriendly (>=8.0) ; extra == 'all'

uploader
===

Dedicated container/script to upload files to openzim/kiwix warehouses and S3

Files are uploaded via SFTP (pubkey authentication) or SCP using OpenSSH.


## Usage

* Specify file to upload with `--file`.
* Mount the RSA private key onto `/etc/ssh/keys/id_rsa` or use `--private_key`
* Use an `scp://` or `sftp://` URI to specify target.
* Specify a full path (with filename) to upload to a specific name or end with a `/` for uploading inside a folder

``` sh
docker run \
    -v ~/.ssh/id_rsa:/etc/ssh/keys/id_rsa:ro \
    -v /path/:/path:rw \
    openzim/uploader \
    uploader \
    --file /path/my_file.zim \
    --upload-uri sftp://uploader@warehouse.farm.openzim.org/zim/ \
    --move \
    --delete
```

### Parameters

* `--username`: if your URI has no username, you can specify it here.
* `--move`: upload to a temporary filename (`<fname>.tmp`) and rename it upon completion. Note that SCP is not able to do it so it uploads an `<fname>.complete` file upon completion instead.
* `--delete`: delete source file once uploaded successfuly.
* `--compress`: enable transfer compression.
* `--bandwidth`: enable bandwidth limit. Set it in Kbps.
* `--cipher`: change default cipher (`aes128-ctr`).
* `--resume`: resume partially uploaded file (SFTP only)

### Python

[![PyPI version shields.io](https://img.shields.io/pypi/v/openzim_uploader)](https://pypi.org/project/openzim_uploader/)

```sh
pip3 install openzim_uploader[all]
openzim-uploader --help
```

```py
from openzim_uploader import check_and_upload_file

check_and_upload_file(
    src_path="/path/my_file.zim",
    upload_uri="sftp://uploader@warehouse.farm.openzim.org/zim/",
    private_key="~/.ssh/id_rsa",
)
```

_Note_: `check_and_upload_file` returns an unix-like returncode (`0` on success)


