..
Copyright 2021-2023 BlueCat Networks (USA) Inc. and its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
BlueCat Libraries
=================
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)
- Address Manager Legacy REST v1 API (9.3, 9.4, 9.5)
- Address Manager Failover API
- DNS Edge API
- Micetro REST API
.. note::
BlueCat strongly recommends using the RESTful v2 API instead of the Legacy v1 API.
The RESTful v2 API strictly adheres to HTTP 1.1 constraints as detailed in RFC 2616,
and allows for cleaner, more understandable code.
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
---------------------------------------------
.. code-block:: python
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
------------------------------------------------
.. code-block:: python
# 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
---------------------------------------------
.. code-block:: python
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.
Raw data
{
"_id": null,
"home_page": "https://docs.bluecatnetworks.com",
"name": "bluecat-libraries",
"maintainer": "BlueCat",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "BlueCat",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/27/06/9813608954cfdd0ce1cd1e22b03401016947024e4aac8a929fc0e0f041ab/bluecat_libraries-24.3.2.tar.gz",
"platform": null,
"description": "..\n Copyright 2021-2023 BlueCat Networks (USA) Inc. and its affiliates.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n\nBlueCat Libraries\n=================\n\nModules for working with products from BlueCat Networks.\n\nThe Python clients in this package provide access to the following BlueCat HTTP APIs:\n\n- Address Manager RESTful v2 API (9.5)\n- Address Manager Legacy REST v1 API (9.3, 9.4, 9.5)\n- Address Manager Failover API\n- DNS Edge API\n- Micetro REST API\n\n.. note::\n\n BlueCat strongly recommends using the RESTful v2 API instead of the Legacy v1 API.\n The RESTful v2 API strictly adheres to HTTP 1.1 constraints as detailed in RFC 2616,\n and allows for cleaner, more understandable code.\n\nThe examples below illustrate how to use the Address Manager RESTful v2 API and Legacy v1\nAPI to fetch BlueCat Address Manager (BAM) configurations.\n\n\nExamples using Address Manager RESTful v2 API\n---------------------------------------------\n\n.. code-block:: python\n\n from bluecat_libraries.address_manager.apiv2 import Client, MediaType\n import csv\n\n # Retrieve the configurations. Request the data as per BAM's default content type.\n with Client(<bam_url>) as client:\n client.login(<username>, <password>)\n response = client.http_get(\"/configurations\")\n configurations = response[\"data\"]\n for configuration in configurations:\n print(f'{configuration[\"id\"]}: {configuration[\"name\"]}')\n client.logout()\n\n # Retrieve the configurations. Request that the response is in 'JSON' format.\n # The result should contain only fields 'id' and 'name'.\n with Client(<bam_url>) as client:\n client.login(<username>, <password>)\n response = client.http_get(\n \"/configurations\",\n params={\"fields\": \"id,name\"},\n headers={\"Accept\": MediaType.JSON},\n )\n configurations = response[\"data\"]\n for configuration in configurations:\n print(f'{configuration[\"id\"]}: {configuration[\"name\"]}')\n client.logout()\n\n # Retrieve configurations. Request that the response is in 'CSV' format.\n # The result should contain only the first 10, ordered alphabetically by name.\n with Client(<bam_url>) as client:\n client.login(<username>, <password>)\n configurations_csv = client.http_get(\n \"/configurations\",\n params={\"orderBy\": \"asc(name)\", \"limit\": \"10\"},\n headers={\"Accept\": MediaType.CSV},\n )\n configurations = list(csv.reader(configurations_csv.splitlines()))\n for configuration in configurations:\n # NOTE: The 'id' is the first value in a row, the 'name' is the third one.\n print(f\"{configuration[0]}: {configuration[2]}\")\n client.logout()\n\n\nExample using Address Manager Legacy REST v1 API\n------------------------------------------------\n\n.. code-block:: python\n\n # Fetch all configurations from a BlueCat Address Manager server.\n\n from bluecat_libraries.address_manager.api import Client\n from bluecat_libraries.address_manager.constants import ObjectType\n\n with Client(<bam_url>) as client:\n client.login(<username>, <password>)\n configs = client.get_entities(0, ObjectType.CONFIGURATION)\n client.logout()\n\n for config in configs:\n print(config)\n\n\nExamples using Micetro REST API\n---------------------------------------------\n\n.. code-block:: python\n\n from bluecat_libraries.micetro.apiv2 import Client, MediaType\n\n # Retrieve the users. Request the data as per Micetro's default content type.\n\n with Client(<micetro_url>) as client:\n client.authenticate(<username>, <password>)\n response = client.http_get(\"/users\")\n users = response[\"result\"][\"users\"]\n for user in users:\n print(f'{user[\"ref\"]}: {user[\"name\"]}')\n\n # Retrieve users. Request that the response is in 'XML' format.\n\n with Client(<micetro_url>) as client:\n client.authenticate(<username>, <password>)\n response = client.http_get(\"/users\", headers={\"Accept\": MediaType.XML})\n print(response)\n\n\nNote\n----\n\nSubpackage ``bluecat_libraries.address_manager.api.rest.provisional`` is a deprecated dependency of\nBlueCat Gateway, and currently exists while we are still in the pre-deprecation-removal grace\nperiod. It will be removed in the next release of BlueCat Libraries.\n",
"bugtrack_url": null,
"license": "http://www.apache.org/licenses/LICENSE-2.0",
"summary": "Modules for working with BlueCat products.",
"version": "24.3.2",
"project_urls": {
"Homepage": "https://docs.bluecatnetworks.com"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "085c416fb328e34d516efcdf73a7abda750a1ff860d9a0b0f62e92110e443cb4",
"md5": "5b79c3538e684b57e39000868ee67a62",
"sha256": "b70df2b8a90d8d32db7adc337e42f52f3a114ecec6f81dba197f3a866ea8879c"
},
"downloads": -1,
"filename": "bluecat_libraries-24.3.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5b79c3538e684b57e39000868ee67a62",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 149825,
"upload_time": "2024-10-31T13:48:53",
"upload_time_iso_8601": "2024-10-31T13:48:53.119237Z",
"url": "https://files.pythonhosted.org/packages/08/5c/416fb328e34d516efcdf73a7abda750a1ff860d9a0b0f62e92110e443cb4/bluecat_libraries-24.3.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "27069813608954cfdd0ce1cd1e22b03401016947024e4aac8a929fc0e0f041ab",
"md5": "2eb75cc7ecb09340d2d1685fd2fd1196",
"sha256": "6b02b774e9f07bc0ef4f48b30a5a35cabb7de9fdd9d330dfbc1752ed8ea937d6"
},
"downloads": -1,
"filename": "bluecat_libraries-24.3.2.tar.gz",
"has_sig": false,
"md5_digest": "2eb75cc7ecb09340d2d1685fd2fd1196",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 117309,
"upload_time": "2024-10-31T13:48:55",
"upload_time_iso_8601": "2024-10-31T13:48:55.041841Z",
"url": "https://files.pythonhosted.org/packages/27/06/9813608954cfdd0ce1cd1e22b03401016947024e4aac8a929fc0e0f041ab/bluecat_libraries-24.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-31 13:48:55",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "bluecat-libraries"
}