Metadata-Version: 2.4
Name: elements-http-upload
Version: 0.2.0
Summary: A small convenience command-line utility to upload files via HTTP to an elements instance
Author-email: "Philipp S. Sommer" <philipp.sommer@hereon.de>
Maintainer-email: "Philipp S. Sommer" <philipp.sommer@hereon.de>
License: Apache-2.0
Project-URL: Homepage, https://codebase.helmholtz.cloud/hcdc/elements/elements-http-upload
Project-URL: Documentation, https://elements-http-upload.readthedocs.io/en/latest/
Project-URL: Source, https://codebase.helmholtz.cloud/hcdc/elements/elements-http-upload
Project-URL: Tracker, https://codebase.helmholtz.cloud/hcdc/elements/elements-http-upload/issues/
Keywords: datahub,elements,mams,python,http,file transfer
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSES/Apache-2.0.txt
License-File: LICENSES/CC-BY-4.0.txt
License-File: LICENSES/CC0-1.0.txt
Requires-Dist: pydantic>=2.0
Requires-Dist: pydantic-settings
Requires-Dist: requests
Requires-Dist: progressbar2
Provides-Extra: testsite
Requires-Dist: tox; extra == "testsite"
Requires-Dist: isort==7.0.0; extra == "testsite"
Requires-Dist: black==25.9.0; extra == "testsite"
Requires-Dist: blackdoc==0.4.6; extra == "testsite"
Requires-Dist: flake8==7.3.0; extra == "testsite"
Requires-Dist: pre-commit; extra == "testsite"
Requires-Dist: mypy==1.18.2; extra == "testsite"
Requires-Dist: pytest-cov; extra == "testsite"
Requires-Dist: reuse==6.2.0; extra == "testsite"
Requires-Dist: cffconvert; extra == "testsite"
Requires-Dist: types-requests; extra == "testsite"
Provides-Extra: docs
Requires-Dist: sphinx-argparse; extra == "docs"
Requires-Dist: autodocsumm; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"
Requires-Dist: hereon-netcdf-sphinxext; extra == "docs"
Requires-Dist: sphinx-design; extra == "docs"
Requires-Dist: myst_parser; extra == "docs"
Provides-Extra: dev
Requires-Dist: elements-http-upload[testsite]; extra == "dev"
Requires-Dist: elements-http-upload[docs]; extra == "dev"
Requires-Dist: reuse-shortcuts>=1.0.1; extra == "dev"
Requires-Dist: types-PyYAML; extra == "dev"
Dynamic: license-file

<!--
SPDX-FileCopyrightText: 2025 Helmholtz-Zentrum hereon GmbH

SPDX-License-Identifier: CC-BY-4.0
-->

# Elements HTTP Upload Uitility

[![CI](https://codebase.helmholtz.cloud/hcdc/elements/elements-http-upload/badges/main/pipeline.svg)](https://codebase.helmholtz.cloud/hcdc/elements/elements-http-upload/-/pipelines?page=1&scope=all&ref=main)
[![Code coverage](https://codebase.helmholtz.cloud/hcdc/elements/elements-http-upload/badges/main/coverage.svg)](https://codebase.helmholtz.cloud/hcdc/elements/elements-http-upload/-/graphs/main/charts)
<!-- TODO: uncomment the following line when the package is registered at https://readthedocs.org -->
<!-- [![Docs](https://readthedocs.org/projects/elements-http-upload/badge/?version=latest)](https://elements-http-upload.readthedocs.io/en/latest/) -->
[![Latest Release](https://codebase.helmholtz.cloud/hcdc/elements/elements-http-upload/-/badges/release.svg)](https://codebase.helmholtz.cloud/hcdc/elements/elements-http-upload)
<!-- TODO: uncomment the following line when the package is published at https://pypi.org -->
<!-- [![PyPI version](https://img.shields.io/pypi/v/elements-http-upload.svg)](https://pypi.python.org/pypi/elements-http-upload/) -->
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
<!-- TODO: uncomment the following line when the package is registered at https://api.reuse.software -->
<!-- [![REUSE status](https://api.reuse.software/badge/codebase.helmholtz.cloud/hcdc/elements/elements-http-upload)](https://api.reuse.software/info/codebase.helmholtz.cloud/hcdc/elements/elements-http-upload) -->


A small convenience command-line utility to upload files via HTTP to an elements instance

The command-line utility provided by this package has been tested with an [ELEMENTS](https://elements.tv/) installation
of v25.1.2. It mimics the upload of the web interface when uploading a file via HTTP(S). The file is split into
chunks and uploaded one by one.

**Note that the authors of this package are not affiliated in any kind with syslink GmbH (the copyright holders of elements).**

## Installation

Install this package in a dedicated python environment via

```bash
python -m venv venv
source venv/bin/activate
pip install elements-http-upload
```

To use this in a development setup, clone the [source code][source code] from
gitlab, start the development server and make your changes::

```bash
git clone https://codebase.helmholtz.cloud/hcdc/elements/elements-http-upload
cd elements-http-upload
python -m venv venv
source venv/bin/activate
make dev-install
```

More detailed installation instructions my be found in the [docs][docs].


[source code]: https://codebase.helmholtz.cloud/hcdc/elements/elements-http-upload
[docs]: https://elements-http-upload.readthedocs.io/en/latest/installation.html

## Command-line usage

To upload a file, run

```bash
elements-http-upload -t <api-token> -H https://<elements-host> <local-file>:<remote-folder>/<remote-file>
```

An API token can be retrieved from the MAMS web interface by clicking your profile in the upper right corner and
selecting the *API* tab. For further instructions, please have a look into the [usage docs][usage docs].

[usage docs]: https://elements-http-upload.readthedocs.io/en/latest/usage.html

## API usage

To use it from within python, see the following example and the
[usage docs][usage docs] for more

```python
from elements_http_upload import upload

upload_info = {
    "source": "<local-file>",
    "target": "<remote-folder>/<remote-file>",
}

upload(
    upload_info,
    host="https://<elements-host>",
    api_token="<api-token>",
)
```

## Technical note

This package has been generated from the template
https://codebase.helmholtz.cloud/hcdc/software-templates/python-cli-package-template.git.

See the template repository for instructions on how to update the skeleton for
this package.


## License information

Copyright © 2025 Helmholtz-Zentrum hereon GmbH



Code files in this repository are licensed under the
Apache-2.0, if not stated otherwise
in the file.

Documentation files in this repository are licensed under CC-BY-4.0, if not stated otherwise in the file.

Supplementary and configuration files in this repository are licensed
under CC0-1.0, if not stated otherwise
in the file.

Please check the header of the individual files for more detailed
information.



### License management

License management is handled with [``reuse``](https://reuse.readthedocs.io/).
If you have any questions on this, please have a look into the
[contributing guide][contributing] or contact the maintainers of
`elements-http-upload`.

[contributing]: https://elements-http-upload.readthedocs.io/en/latest/contributing.html
