Skip to content

yeti-switch/yeti-switch-api-python

Repository files navigation

Yeti-web Admin API SDK

tests workflow

The documentation for the Yeti-web Admin API can be found here.

Installation

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

Usage

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.

Development

Requirements

pipenv can be installed via apt install pipenv

Python 3.7+

Install dependencies

pipenv install --dev

Lint with flake8

pipenv run python -m flake8 . --count --show-source --statistics

Fix code format with Black

pipenv run python -m black .

Release

Change __version_info__ in yeti_switch_api/__init__.py

Build package

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

Check package

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

Upload package to test pypi

pipenv run python -m twine upload -r testpypi dist/*

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages