mreg-api¶
mreg-api is a Python client library for the MREG
REST API. It gives you a typed, ergonomic interface to every MREG
resource — hosts, networks, DNS records, zones, and more — through a single client
object with scoped namespaces for each resource type.
It provides optional caching of resources, automatic FQDN expansion of hostnames, and a consistent interface for all resource types. The client is compatible with Python 3.11 and later.
Install¶
pip:
uv:
Connect¶
import os
from mreg_api import MregClient
client = MregClient(url="https://mreg.example.com", domain="example.com")
client.login(
username=os.environ["MREG_USERNAME"],
password=os.environ["MREG_PASSWORD"],
)
host = client.host.get("myhost")
Where to go next¶
- Quick start — the essentials in a few minutes.
- Guides — Client configuration, Authentication, Caching, and Working with resources.
- API reference — full reference for the client, managers, models, events, cache, and exceptions.