Skip to content

Advanced functions to use the MaStR SOAP-API

open_mastr.soap_api.download.MaStRAPI

Bases: object

Access the Marktstammdatenregister (MaStR) SOAP API via a Python wrapper

Read about MaStR account and credentials how to create a user account and a role including a token to access the MaStR SOAP API.

Create an MaStRAPI instance with your role credentials

   mastr_api = MaStRAPI(
        user="SOM123456789012",
        key="koo5eixeiQuoi'w8deighai8ahsh1Ha3eib3coqu7ceeg%ies...",
        service_port="Anlage"
   )

Alternatively, leave user and key empty if user and token are accessible via credentials.cfg. How to configure this is described here.

    mastr_api = MaStRAPI()

Now, you can use the MaStR API instance to call pre-defined SOAP API queries via the class' methods. A documentation of all API methods is available at the BNetzA website within the downloadable zip folder Dienstbeschreibung Produktion Version X.X.X For example, get a list of units limited to two entries.

   mastr_api.GetListeAlleEinheiten(limit=2)

Note

As the example shows, you don't have to pass credentials for calling wrapped SOAP queries. This is handled internally.

__init__(user=None, key=None, service_port='Anlage')

PARAMETER DESCRIPTION
user

MaStR-ID (MaStR-Nummer) for the account that was created on https://www.marktstammdatenregister.de Typical format: SOM123456789012

TYPE: str DEFAULT: None

key

Access token of a role (Benutzerrolle). Might look like: "koo5eixeiQuoi'w8deighai8ahsh1Ha3eib3coqu7ceeg%ies..."

TYPE: str DEFAULT: None

service_port

Port/model to be used, e.g. "Anlage" or "Akteur", see docs for full list: https://www.marktstammdatenregister.de/MaStRHilfe/subpages/webdienst.html Defaults to "Anlage".

TYPE: str DEFAULT: 'Anlage'