Skip to content

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:

pip install mreg-api

uv:

uv add mreg-api

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