Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bero158/glslabel
GLS API yaml + auto-generated openapi client + CLI for downloading the labels
https://github.com/bero158/glslabel
api-rest cli delivery gls labels openapi openapi-specification python
Last synced: 26 days ago
JSON representation
GLS API yaml + auto-generated openapi client + CLI for downloading the labels
- Host: GitHub
- URL: https://github.com/bero158/glslabel
- Owner: bero158
- Created: 2024-12-18T21:38:08.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-12-20T17:39:43.000Z (29 days ago)
- Last Synced: 2024-12-20T18:21:47.516Z (29 days ago)
- Topics: api-rest, cli, delivery, gls, labels, openapi, openapi-specification, python
- Language: Python
- Homepage: https://github.com/bero158/glslabel
- Size: 52.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
YAML and OpenAPI auto-generated client for GLS API
==================================================[GLS](https://gls-group.com) is a delivery company operating in middle Europe.
In this repository there's a gls.yaml file and a simple code for use [GLS API described here:](https://api.mygls.cz/)
I've developed this code because GLS company currently doesn't provide yaml.
Gls.yaml file is generated from the provided documentation by AI and heavily modified by myself.
Rest of the client is autogenerated from gls.yaml with [OpenAPI generator](https://opencollective.com/openapi_generator)getprintedlabels.py is a CLI implementation of getPrintedLabels. It can create PDF from:
* Package Nr. (that code printed on the label)
* Package ID (internal number in GLS database. It's the number you get from PrepareLabels API call)Features
--------
* Behavior can be configured through settings.local.toml or via env. variables starting with prefix GLSLABEL
* Secrets are stored in .secrets.toml (you must create it)
* In case the label exists and can't be printed (because of lack of this ability from GLS then a copy of the label is made and the copied label is stored and/or printed)Dependencies
------------* urllib3
* python_dateutil
* pydantic
* typing-extensions
* dynaconf
* hashlib
* argparseInstallation
------------
* clone the repository
* create venv (python -m venv .venv)
* install the main package (.venv/bin/pip install -e glslabelapi)
* install the openapi_client generated package (.venv/bin/pip install -e glslabelapi/openapi_client)
* check, add or modify settings.local.toml and .secrets.tomlUsage
-----`python getprintedlabels.py -id -o label.pdf -p`
Expected behavior is you get PDF with label(s) or API error.(Re)Generate API
----------------
npx @openapitools/openapi-generator-cli generate -i gls.yaml -g python -o ./glslabelapiCurrent state
-------------
* DeleteLabels and PrepareLabels weren't tested. Check it before you use it.
* There may be glitches in yaml definition caused by lack of documentation.