Skip to main content

An API Client to use BlueCat RESTful API.

Project description

BlueCatAPIClient

Proteus_API_Guide_3.7.1
Making APIs Work for You
BlueCat Gateway


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

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

How to install

$ pip install BlueCatAPIClient

Usage

The argument "method" must be specify every time.

Default arguments and attributes

import BlueCatAPIClient

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

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

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

Getting entities

import BlueCatAPIClient
import json

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

response = client.get(method='searchByCategory', keyword='MyIPV4Block', category='all', count=1)
print(json.dumps(response.json(), indent=4))

client.disconnect()

Paging

import BlueCatAPIClient
import json

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

response = client.get(method='searchByCategory', keyword='MyIPV4Block', category='all', start=0, count=1)
print(json.dumps(response.json(), indent=4))

client.disconnect()

Filtering entities

import BlueCatAPIClient
import json

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

response = client.get(method='getEntityById', id='12345')
print(json.dumps(response.json(), indent=4))

client.disconnect()

How to work with properties

import BlueCatAPIClient
import json

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

response = client.get(method='searchByCategory', keyword='MyIPV4Block', category='all', start=0, count=1)
if response.status_code == 200:
    properties = client.properties_to_json(response.json()[0].get('properties', ''))
    print(properties)

    print(client.json_to_properties(properties))

client.disconnect()

Creating entities

import BlueCatAPIClient
import json

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

response = client.post(method='addIP4BlockByCIDR', parentId='12345', CIDR='10.0.0.1/24', properties='name=MyIPV4Block')
print(json.dumps(response.json(), indent=4))

client.disconnect()

Updating entities

import BlueCatAPIClient
import json

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

response = client.get(method='searchByCategory', keyword='MyIPV4Block', category='all', start=0, count=1)
update_entity = response.json()[0]
update_entity['name'] = 'MyIPV4Block_TEST'
response = client.put(update_entity)
print(json.dumps(response.json(), indent=4))

client.disconnect()

Deleting entities

import BlueCatAPIClient
import json

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

response = client.delete(ObjectId=12345)
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

BlueCatAPIClient-0.0.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

BlueCatAPIClient-0.0.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: BlueCatAPIClient-0.0.1.tar.gz
  • Upload date:
  • Size: 5.7 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 BlueCatAPIClient-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ebe0844b2c4c8a517894e0ece29ca195bf544c3432c11f15a27c63a918e8775e
MD5 58afa8cd5ff5f3ab57084d323f9f35f2
BLAKE2b-256 ef601df3b81595e0d65953bf62685f225f21f0d90a1b2d9afd7b166348e740c0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: BlueCatAPIClient-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 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 BlueCatAPIClient-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5b1f396b941c36bd0c9624eefd70e20e8f550c767dee9f34b9a84d7ad1ca05f5
MD5 83e2b4bc945bbd1f44ead18205c060ec
BLAKE2b-256 5f7cb1e0e26e6141e37ba7ca1b6da062ea9c200b960ff75999fba195ab35dba1

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