Universal vManage API
Project description
vManage-client
vManage client is a package for creating simple and parallel automatic requests via official vManageAPI. It is intended to serve as a multiple session handler (provider, provider as a tenant, tenant). The library is not dependent on environment which is being run, you just need a connection to any vManage.
Installation
pip install vmngclient
Hello world example
Python (click to expand)
from vmngclient.session import create_vManageSession
base_url = "sandbox-sdwan-2.cisco.com/"
username = "devnetuser"
password = "RG!_Yw919_83"
session = create_vManageSession(url=base_url, username=username, password=password)
>>> "Logged as devnetuser. The session type is SessionType.TENANT"
>>> {'title': 'Cisco vManage', 'version': '20.4.2.1', 'applicationVersion': '20.4R-vbamboo-16-Dec-2021 19:07:17 PST', 'applicationServer': 'vmanage', 'copyright': 'Copyright (c) 2022, Cisco. All rights reserved.', 'time': '2022-12-01 13:45:44', 'timeZone': 'UTC', 'logo': '/dataservice/client/logo.png'}
Note:
To remove InsecureRequestWarning, you can include in your scripts:
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
User creation example
Python (click to expand)
from vmngclient.api.administration import UserAlreadyExistsError, UserApi
from vmngclient.dataclasses import User
from vmngclient.session import create_vManageSession
session = create_vManageSession(url=..., username=..., password=...)
user_api = UserApi(session)
test_user = User(
group=["basic"],
description="Demo User",
username="demouser",
password="password",
locale="en_US",
resource_group="global"
)
try:
user_api.create_user(test_user)
except UserAlreadyExistsError as error:
print(f"User {username} already exists.")
API usage examples
AdminTechAPI
Python (click to expand)
from vmngclient.session import create_vManageSession
from vmngclient.api.admin_tech_api import AdminTechAPI
session = create_vManageSession(url=..., username=..., password=...)
admintech = AdminTechAPI(session)
filename = admintech.generate("172.16.255.11")
admintech.download(filename)
admintech.delete(filename)
Contributing, reporting issues, seeking support
Please contact authors direcly or via Issues Github page.
Enviroment setup
- Download Python3.8 or higher.
- Download repository
git clone https://github.com/CiscoDevNet/vManage-client.git - Install poetry v1.3.1
pip install poetry==1.3.1 - Configure poetry to use virtual environments in project folder (can ease IDE integration)
poetry config virtualenvs.in-project true - Install dependecies
poetry install - Activate
pre-commitpre-commit install
Add new feature
To add new feature create new branch and implement it. Before making a pull request make sure that pre-commit passes.
- Building package for tests
To make a.whlfile run
Then inpoetry build/vManage-client/dist/directory there is a.whlfile namedvmngclient-<version>-py3-none-any.whl, which can be installed by runningpip install vmngclient-<version>-py3-none-any.whl
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vmngclient-0.5.0.tar.gz.
File metadata
- Download URL: vmngclient-0.5.0.tar.gz
- Upload date:
- Size: 47.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.8.15 Linux/5.15.0-1030-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f39194002da47b97ee233a79811b11c97210b5f5aa54afcd56824571342aa39b
|
|
| MD5 |
779707f96957d9bac7e985912a06ed71
|
|
| BLAKE2b-256 |
4b896295cfc9b864451def648ca8e7e266cde0443ed47e818e76f1bb097bad2d
|
File details
Details for the file vmngclient-0.5.0-py3-none-any.whl.
File metadata
- Download URL: vmngclient-0.5.0-py3-none-any.whl
- Upload date:
- Size: 63.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.8.15 Linux/5.15.0-1030-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d423bf56b239d64713d923e46e66f6c228987b38043a46c0cdc818b6f087c5c1
|
|
| MD5 |
c83a9822b8730f42b6bc99d792ef5a15
|
|
| BLAKE2b-256 |
74ac797deea9d5d45458f40584c3b84a6d87ceff56348cdc80a4023175abfdda
|