Python SDK
I'm looking at using the Python SDK to add some devices.
When I go to define the body of the call (as per the example) it's complaining about Swagger not defined.
QuoteTraceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'swagger_client' is not defined
I can't install 'swagger_client' from pip. Is there some way I should be installing this to use for the SDK?
Any help appreciated.
Thanks
MrJ
4 comments
LM User
That example is overly descriptive. I was able to do it with this (uses my custom sdk wrapper )
The body is just a python dictionary, no need for the swagger library to be installed manually.
To get the device id, i did
This is where the 152 came from in my call above.
Once I had the device id, i did:
To get the list of datasources and their IDs. This is where the 9042 came from in my call above.
MrJ
OPThanks for the link. I will have a look, at first glance it seems very similar/same to the original link I used. The issue I was having was python didn't know what Swagger client was. I figured out you need to take and generate a swagger python client installation. After that it worked. I don't see that documented anywhere in the documentation.
Michael Baker
This is prob a better doc to follow obv you need to change the auth path but any method in swagger doc should be on here with example code using the official SDK https://github.com/logicmonitor/lm-sdk-python/blob/master/LMApi.md
MrJ
OPI think I figured this out, more by luck. I stumbled across this site "https://editor.swagger.io/" and I found the json file on the LM Swagger site, I popped it in there and generated a python client config. It seems to import the body now.