Skip to main content

Universal vManage API

Project description

vManage-client

Python3.8

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

  1. Download Python3.8 or higher.
  2. Download repository
    git clone https://github.com/CiscoDevNet/vManage-client.git
    
  3. Install poetry v1.1.13
    pip install poetry==1.1.13
    
  4. Install dependecies
    poetry install
    
  5. Activate pre-commit
    pre-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 .whl file run
    poetry build
    
    Then in /vManage-client/dist/ directory there is a .whl file named vmngclient-<version>-py3-none-any.whl, which can be installed by running
    pip 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

vmngclient-0.2.0.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vmngclient-0.2.0-py3-none-any.whl (46.3 kB view details)

Uploaded Python 3

File details

Details for the file vmngclient-0.2.0.tar.gz.

File metadata

  • Download URL: vmngclient-0.2.0.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.15 Linux/5.15.0-1024-azure

File hashes

Hashes for vmngclient-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6e1497e9ddba643b40228d6b6f0e23d425a0d25aa4de2a1408875780ed9f7fde
MD5 3811bc7ea07441bf8b6332223811125d
BLAKE2b-256 f4f7fed187c7878d8c90b55ee652d069e0414a3260f08b740904d7f34542aa69

See more details on using hashes here.

File details

Details for the file vmngclient-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: vmngclient-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 46.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.15 Linux/5.15.0-1024-azure

File hashes

Hashes for vmngclient-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c37b57da96c57c594f7c1e449fbbb76ae777084a15353f2b7734ee0a80f2d26
MD5 3dcf3a8f79dd0d421d45b348dbd1e874
BLAKE2b-256 bd603d0d4e35f6f7d34ca4697c67392edabc4f043eb69f1db08ad5970e24211f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page