I'm using EventGhost to post information to the http inputs on the Loxone Miniserver (e.g. now playing information). This worked using this Python script in Eventghost:
import urllib2 import urllib # create a password manager password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm() # Add the username and password. # If we knew the realm, we could use it instead of None. top_level_url = "http://xxx.xxx.xxx.xxx:xx/dev/sps/io/SetStudySqueezeboxAlbum/"+urllib.quote(eg.event.payload["Album"]) password_mgr.add_password(None, top_level_url, "admin", "admin") handler = urllib2.HTTPBasicAuthHandler(password_mgr) # create "opener" (OpenerDirector instance) opener = urllib2.build_opener(handler) # use the opener to fetch a URL opener.open(top_level_url) # Install the opener. # Now all calls to urllib2.urlopen use our opener. urllib2.install_opener(opener)
Traceback (most recent call last): Python script "15", line 7, in <module> top_level_url = "http://xxx.xxx.xxx.xxx:xx/dev/sps/io/SetStudySqueezeboxAlbum/"+urllib.quote(eg.event.payload["Album"]) TypeError: 'NoneType' object is unsubscriptable
Thanks!
Jörg
Kommentar