Skip to main content

An API Client to use Prime RESTful API.

Project description

PrimeAPIClient

Cisco Prime Infrastructure API
REST API Resources


PyPI - Status PyPI - Format GitHub GitHub release (latest by date) PyPI - Python Version

An API Client for Prime to be able to easily use the API in a more standard way.

How to install

$ pip install PrimeAPIClient

Usage

the argument "method" must be specify every time. Look at authentication validation for an example.

Default arguments and attributes

import PrimeAPIClient

client = PrimeAPIClient.Client(verify=False, warnings=False, api_version='v1')

client.get(url=None, method='', data=None, auth = None)

# client.headers
# client.url_base
# client.token

The first query

import PrimeAPIClient
import json

client = PrimeAPIClient.Client()
client.connect(url='https://Prime-server.local', username='admin', password='Admin123')

response = client.get(method='/data/Alarms.json')
print(json.dumps(response.json(), indent=4))

client.disconnect()

Getting detailed information

import PrimeAPIClient
import json

client = PrimeAPIClient.Client()
client.connect(url='https://Prime-server.local', username='admin', password='Admin123')

query_string = {'.full': 'true'}
response = client.get(method='/data/Alarms.json', **query_string)
print(json.dumps(response.json(), indent=4))

client.disconnect()

Sorting

import PrimeAPIClient
import json

client = PrimeAPIClient.Client()
client.connect(url='https://Prime-server.local', username='admin', password='Admin123')

query_string = {'.full': 'true', '.sort': 'severity'}
response = client.get(method='/data/Alarms.json', **query_string)
print(json.dumps(response.json(), indent=4))

client.disconnect()

Filtering

import PrimeAPIClient
import json

client = PrimeAPIClient.Client()
client.connect(url='https://Prime-server.local', username='admin', password='Admin123')

query_string = {'.full': 'true', '.sort': 'severity', 'category.value': 'AP',
                    'message': 'contains("interface")'}
response = client.get(method='/data/Alarms.json', **query_string)
print(json.dumps(response.json(), indent=4))

client.disconnect()

Paging

import PrimeAPIClient
import json

client = PrimeAPIClient.Client()
client.connect(url='https://Prime-server.local', username='admin', password='Admin123')

query_string = {'.full': 'true', '.sort': 'severity', 'category.value': 'AP',
                    'message': 'contains("interface")', '.maxResults': '5'}
response = client.get(method='/data/Alarms.json', **query_string)
print(json.dumps(response.json(), indent=4))

client.disconnect()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PrimeAPIClient-0.0.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

PrimeAPIClient-0.0.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file PrimeAPIClient-0.0.1.tar.gz.

File metadata

  • Download URL: PrimeAPIClient-0.0.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for PrimeAPIClient-0.0.1.tar.gz
Algorithm Hash digest
SHA256 976a565f171bfffb8f23dd42d1af9175bac3f32e55e541bc0d73ce5cd59d1c91
MD5 f53ec17352f6d639baae06059f2e80ee
BLAKE2b-256 432fd3ea41156a59d4533a67ed1f29668e7397110069d4a0ead04b3fb9e26852

See more details on using hashes here.

File details

Details for the file PrimeAPIClient-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: PrimeAPIClient-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for PrimeAPIClient-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31fa18999bae79e9d5d8bd9d88ff8243fdd3f727aa9a8840317e00c51935b5f7
MD5 0c0129c22cc6ec881662500f1f89c843
BLAKE2b-256 9eab22eb26da205202a97cb7abc6561a059a278cf461387d982f0bdd3a7cf9b0

See more details on using hashes here.

Supported by

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