elog-cli
Overview
elog-cli is a command-line interface for managing elog entries and authentication. It interacts with the elog management backend and supports OAuth2 authentication.
Installation
To install elog-cli, clone the repository and install the required dependencies:
git clone https://github.com/yourusername/elog-cli.git
cd elog-cli
pip install -r requirements.txt
Environment Variables
The following environment variables need to be set for the authentication manager to work:
ELOG_CLI_CODE_FLOW_SERVER_URL: The URL of the OAuth2 code flow server (e.g.,https://<hostname>/device/code).ELOG_CLI_TOKEN_URL: The URL to obtain the token (e.g.,https://<hostname>/token).ELOG_CLI_CLIENT_ID: The client ID for OAuth2 authentication.ELOG_CLI_CLIENT_SECRET: The client secret for OAuth2 authentication.ELOG_CLI_ENPOINT_URL: The base URL for the elog management backend client.
Development
This project uses a devcontainer to run a complete setup environment to permit developers to work on the CLI. The devcontainer starts the elog backend container so the developer can interact with the backend without using the official one.
-
Download the mock user authentication data:
wget http://elog:8080/v1/mock/users-auth -O user.json
-
Generate the Python client from the OpenAPI specification:
~/.local/bin/openapi-python-client generate --url http://elog:8080/api-docs --output-path elog_management_backend_client --overwrite
-
Ensure all required environment variables are set:
export ENPOINT_URL="http://elog:8080"
-
Run the application:
python main.py login --login-type token
and paste one of the tokens found in the above downloaded
user.json.
Helper Executable
A helper executable elog-cli is provided to simplify running the CLI. This script loads environment variables from a .env file and locates the main.py script to execute it. elog-cli helper try to find the .env file into the same directory of the script, to modify this behaviour the ELOG_CLI_ENV_FILE_PATH environment variable that point to the specific .env file can be used.
Usage
- Ensure the
.envfile is present in the root directory of the project. - Make the
elog-cliscript executable:chmod +x elog-cli
- Run the
elog-cliscript with the desired commands:./elog-cli login --login-type token
Contributing
Contributions are welcome! Please fork the repository and submit a pull request.
patching on e;log generated rest api
patch class NewEntryWithAttachmentBody on file elog_cli/elog_management_backend_client/models/new_entry_with_attachment_body.py
def to_multipart(self) -> dict[str, Any]:
fields = [("entry", (None, json.dumps(self.entry.to_dict()).encode(), "application/json"))]
# Include files
if not isinstance(self.files, Unset):
for files_item_data in self.files:
# Convert each file to a tuple (fieldname, content, content_type)
files_item = files_item_data.to_tuple()
fields.append(("files", (files_item[0], files_item[1], files_item[2])))
# Add additional properties
for prop_name, prop in self.additional_properties.items():
fields.append((prop_name, (None, str(prop).encode(), "text/plain")))
return fields
Metadata
Release files for elog-cli 0.1.40
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| elog_cli-0.1.40.tar.gz | 57.7 kB | Without provenance | Details for elog_cli-0.1.40.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| elog_cli-0.1.40-py3-none-any.whl | Python 3 | none | any | Details for elog_cli-0.1.40-py3-none-any.whl |
Total release size: 215.6 kB
Release files / elog_cli-0.1.40.tar.gz
| Download URL | elog_cli-0.1.40.tar.gz |
|---|---|
| Size | 57.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
410fad7628e8a1a0b9ccd0616cf05911e3bbfeb5d77de27620fed72be9dadcf1
|
|
BLAKE2b-256 checksum How to use checksums |
bfb55b561b1fa14ad66f5d4725c1594545ee1b0c1d7587023f9553e6a93ed618
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|
Release files / elog_cli-0.1.40-py3-none-any.whl
| Download URL | elog_cli-0.1.40-py3-none-any.whl |
|---|---|
| Size | 157.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d08291ce9690a979331872473f7c90bba433b6b964f8eb16e5c5e86236eb199
|
|
BLAKE2b-256 checksum How to use checksums |
7d9e1f875be2da255c46f705cfa020d7ae109fbc0e75b86cbb6cd825f2bceb9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|
Security for elog-cli 0.1.40
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.