The documentation for the Yeti-web Admin API can be found here.
Install from PyPi using pip, a package manager for Python.
pip3 install yeti-switch-api
Or download source code and run:
python3 setup.py install
import yeti_switch_api
yeti_switch_api.orm.OrmClient({
'API_ROOT': 'https://myhost.com/api/rest/admin',
'AUTH_CREDS': {
'login': 'mylogin',
'password': 'mypassword',
},
'VALIDATE_SSL': True,
'TIMEOUT': 10,
})
# refresh auth token in any time
yeti_switch_api.orm.OrmClient.auth.refresh_token()
# use the api
found_contractors = yeti_switch_api.orm.Contractor.get_list()
See examples/
for detailed usage examples.
pipenv can be installed via apt install pipenv
Python 3.7+
pipenv install --dev
pipenv run python -m flake8 . --count --show-source --statistics
pipenv run python -m black .
pipenv run python setup.py sdist
pipenv run python setup.py bdist_wheel
As result you will have files:
dist/yeti_switch_api-<VERSION>.tar.gz
dist/yeti_switch_api-<VERSION>-py3-none-any.whl
pipenv run python -m twine check dist/*
Upload package to pypi
pipenv run python -m twine upload dist/*
Notes: see this guide how to set up pypi account
pipenv run python -m twine upload -r testpypi dist/*