open-MaStR
open-MaStR copied to clipboard
`GetMarktakteur` not part of `soap_api.download.MaStRAPI`
The API call GetMarktakteur
, as described here cannot be called using the python wrapper.
@chrwm Do you understand why this is the case?
The error it throws is 'MaStRAPI' has no attribute GetMarktakteur
I have the same problem did you find a workaround?
I shortly checked the following:
- We do bindings to the download class here. I checked the
wsl
file that is used and there is an operation GetMarktakteur
Unfortunately I have no time within the next weeks to dig deeper. I can investigate this later or maybe @nesnoj has some time?
I have tried a workaround using zeep on my own. This is probably a bit trivial for you @FlorianK13 but could prove useful if someone is looking to access any functions not yet implemented here.
from zeep import Client
wsdl_url = 'https://www.marktstammdatenregister.de/MaStRAPI/wsdl/mastr.wsdl'
apiKey = '4fil24gnio2gno24g2...' # example add your own here
marktakteurMastrNummer = 'SNB91234567890' # example add your "username" here
client = Client(wsdl_url)
client_bind = client.bind('Marktstammdatenregister', 'Akteur')
result = client_bind.GetMarktAkteur(
apiKey=apiKey,
marktakteurMastrNummer=marktakteurMastrNummer,
mastrNummer='SNB91234567890') # Final argument is the Akteurnummer your are requesting
print(result)
I personally still have the issue that my apiKey does not have the writes to access any but suppose that is not an implementation problem.
If you want to adapt this to other functions then you change the 'Akteur'
in client.bind()
to the heading under which your function is featured in the documentation and the operation you call in the following line.
Hey @maxcave,
I digged a bit and it worked out: With zeep I wasn't able to get any data ("ValueError: second must be in 0..59"), cf. #10. But with the own MaStRAPI it worked like a charm (the timing error is suppressed here)...ok, almost like a charm:
As you already state for the service
If you want to adapt this to other functions then you change the
'Akteur'
inclient.bind()
to the heading under which your function is featured in the documentation and the operation you call in the following line.
you have to change it in open-MaStR's code as well here as it is hard-coded :thinking:. After setting it to service_port="Akteur"
the function GetMarktakteur
is available (you'll probably need to install from source to change..).
Working snippet:
from open_mastr.soap_api.download import MaStRAPI
apiKey = "..." # your own key
marktakteurMastrNummer = "..." # your own Marktakteur ID
mastr_api = MaStRAPI(user=marktakteurMastrNummer, key=apiKey)
mastr_api.GetMarktakteur(mastrNummer="SNB941690671609") # should return data from E.DIS Netz GmbH
# Result:
# {'Ergebniscode': 'OK', 'AufrufVeraltet': False, 'AufrufLebenszeitEnde': None, 'AufrufVersion': 1, 'MastrNummer': 'SNB941690671609', ....
I personally still have the issue that my apiKey does not have the writes to access any but suppose that is not an implementation problem.
I used my personal key which has no advanced permissions..
Does this solution work at your end @maxcave?
We should remove this hard-coded "service_port" and allow to pass it as parameter. I will create a separate issue.
As #557 has been merged, you can now just use branch develop
and instantiate MaStRAPI(user, key, service_port="Akteur")
Has been fixed, I will close.. Please reopen if necessary @maxcave