authentication realm?

Einklappen
X
 
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge
  • J V
    LoxBus Spammer
    • 28.08.2015
    • 367

    #1

    authentication realm?

    Hello,

    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:
    Code:
    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)
    But now, I start getting this error:
    Code:
    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
    EDIT: It may be something with the authentication realm ( https://docs.python.org/3/howto/urllib2.html#id5 ),but now it looks more likely it is rather some wrong type in Python... So never mind the question...

    Thanks!


    Jörg
    Zuletzt geändert von J V; 11.08.2016, 10:14.
  • J V
    LoxBus Spammer
    • 28.08.2015
    • 367

    #2
    Just in case anyone comes across this...
    The authentication realm is "/dev/sps/io", but it works with "None".

    My problem was in the eg.event.payload, so completely unrelated to Loxone.

    Kommentar

    Lädt...