Skip to main content

Modules for working with BlueCat products.

Project description

Modules for working with products from BlueCat Networks.

The Python clients in this package provide access to the following BlueCat HTTP APIs:

  • Address Manager RESTful v2 API (9.5, 9.6, 25.1)

  • Address Manager Legacy REST v1 API (9.5. 9.6, 25.1)

  • Address Manager Failover API

  • DNS Edge API

  • Micetro REST API

The examples below illustrate how to use the Address Manager RESTful v2 API and Legacy v1 API to fetch BlueCat Address Manager (BAM) configurations.

Examples using Address Manager RESTful v2 API

from bluecat_libraries.address_manager.apiv2 import Client, MediaType
import csv

# Retrieve the configurations. Request the data as per BAM's default content type.
with Client(<bam_url>) as client:
    client.login(<username>, <password>)
    response = client.http_get("/configurations")
    configurations = response["data"]
    for configuration in configurations:
        print(f'{configuration["id"]}: {configuration["name"]}')
    client.logout()

# Retrieve the configurations. Request that the response is in 'JSON' format.
# The result should contain only fields 'id' and 'name'.
with Client(<bam_url>) as client:
    client.login(<username>, <password>)
    response = client.http_get(
        "/configurations",
        params={"fields": "id,name"},
        headers={"Accept": MediaType.JSON},
    )
    configurations = response["data"]
    for configuration in configurations:
        print(f'{configuration["id"]}: {configuration["name"]}')
    client.logout()

# Retrieve configurations. Request that the response is in 'CSV' format.
# The result should contain only the first 10, ordered alphabetically by name.
with Client(<bam_url>) as client:
    client.login(<username>, <password>)
    configurations_csv = client.http_get(
        "/configurations",
        params={"orderBy": "asc(name)", "limit": "10"},
        headers={"Accept": MediaType.CSV},
    )
    configurations = list(csv.reader(configurations_csv.splitlines()))
    for configuration in configurations:
        # NOTE: The 'id' is the first value in a row, the 'name' is the third one.
        print(f"{configuration[0]}: {configuration[2]}")
    client.logout()

Example using Address Manager Legacy REST v1 API

# Fetch all configurations from a BlueCat Address Manager server.

from bluecat_libraries.address_manager.api import Client
from bluecat_libraries.address_manager.constants import ObjectType

with Client(<bam_url>) as client:
    client.login(<username>, <password>)
    configs = client.get_entities(0, ObjectType.CONFIGURATION)
    client.logout()

for config in configs:
    print(config)

Examples using Micetro REST API

from bluecat_libraries.micetro.apiv2 import Client, MediaType

# Retrieve the users. Request the data as per Micetro's default content type.

with Client(<micetro_url>) as client:
    client.authenticate(<username>, <password>)
    response = client.http_get("/users")
    users = response["result"]["users"]
    for user in users:
        print(f'{user["ref"]}: {user["name"]}')

# Retrieve users. Request that the response is in 'XML' format.

with Client(<micetro_url>) as client:
    client.authenticate(<username>, <password>)
    response = client.http_get("/users", headers={"Accept": MediaType.XML})
    print(response)

Note

Subpackage bluecat_libraries.address_manager.api.rest.provisional is a deprecated dependency of BlueCat Gateway, and currently exists while we are still in the pre-deprecation-removal grace period. It will be removed in the next release of BlueCat Libraries.

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

bluecat_libraries-25.3.0.tar.gz (117.5 kB view details)

Uploaded Source

Built Distribution

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

bluecat_libraries-25.3.0-py3-none-any.whl (151.4 kB view details)

Uploaded Python 3

File details

Details for the file bluecat_libraries-25.3.0.tar.gz.

File metadata

  • Download URL: bluecat_libraries-25.3.0.tar.gz
  • Upload date:
  • Size: 117.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for bluecat_libraries-25.3.0.tar.gz
Algorithm Hash digest
SHA256 cb4e5dac4a9365a78814e58093ef2e60dd9d39cfb8e4a15ff41ec6cfd8a6d8a5
MD5 328686867806b0e465df64e798906d0a
BLAKE2b-256 bd2d08394676bd1a9ac2dbb20aed01e064c83e0cc79db60cb97a9c902980e114

See more details on using hashes here.

File details

Details for the file bluecat_libraries-25.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bluecat_libraries-25.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee321e88e7f2acdc95dc15270dfcf02b4ab37207a6741fa4694484168c3b3b06
MD5 bc3c478e6c6e60210dac9e4fd3ce475a
BLAKE2b-256 dbc3f035e368c3c91fd10d802b0cc7bb31a08e69c4d30390f49c4caa2fd12216

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