I'm trying to create a program to control OpenLp and eventually OBS and a digital mixer.
I'm stuck trying to communicate with Openlp via the http api, everything I try gives a response of 404.
The code below is just one example. Can anyone provide a clue as to what could be wrong.
I am using 2.4.6
# importing the requests library
import requests
# api-endpoint
URL = "http://127.0.0.1:4316/api/v2/controller/live-items"
# sending get request and saving the response as response object
r = requests.get(URL)
print ( r)
Output is: <Response [404]>
Comments
Did you try any other ip address, like another physical interface? Built-in web remote plugin works?
Dont know your use-case.. Did you try Bitfocus Companion? They have integration to almost any controllable piece of sw/hw used in live production.
jednou thanks for your reply.
I did try my local ip address assigned by the router, had same errors.
I can connect to the built-in web remote from my android phone without any issue.
Thinking my problem is either with how I am formatting my call to requests.get or simply an issues with requests.get that I don't understand.
I will not rule out Bitfocus, but want to investigate further a python solution before attempting a totally new path.
OK, if you are using 2.4.6, then response 404 to GET /api/v2/controller/live-items is completely valid.
You can either use v2.4.6 and endpoints described in:
http://api.openlp.io/api/openlp/plugins/remotes.html
Or use 2.9.* and use urls like /api/v2/... as described in:
https://gitlab.com/openlp/wiki/-/wikis/Documentation/http-api
So I switched to using endpoints described at http://api.openlp.io/api/openlp/plugins/remotes.html
I'm trying to move to the next service item, but have no success.
Tried:
import requests
URL = 'http://192.168.0.15:4316/api/service'
payload = {'action':'next'}
r = requests.get(URL, data=payload)
also:
import requests
URL = 'http://192.168.0.15:4316/api/service?next'
r = requests.get(URL)
and:
import requests
URL = 'http://192.168.0.15:4316/api/service?{next}'
r = requests.get(URL)
any help would be much appreciated
Next service item: /api/service/next
Next slide: /api/controller/live/next
jednou, thanks for your response, but I do know what endpoints to use.
My question is how to incorporate them into python code.
import requests
URL = "http://192.168.0.15:4316/api/service/next"
response = requests.get(URL)
print(response)
jednou, Thanks that is exactly what I needed. Works perfectly!
Now I can move to next and previous items in service.
Now I need help to jump to a specific item. I tried but failed with:
URL = 'http://127.0.0.1:4316/api/service/jump?{"request": {"id": 2}}'
r = requests.get(URL)
import requests
url = "http://127.0.0.1:4316/api/service/set?data={\"request\": {\"id\": 2}}"
response = requests.get(url)
print(response)