HTSP Python, Authentication problems
Over the past few days, I tried to build a Plex Channel plugin for TVHeadend using the official HTSP API (instead of the undocumented internal JSON API like most of the older Plugins do)
As Plex Plugins are written in Python, my first idea was to just use the python library shipping with the TVheadend sources.
However Plex Plugins are running in a sandboxed environment using the RestrictedPython Library.
This adds quite a bunch of restrictions to the code, making it neccessary to modify the tvheadend libraries to some extent.
For example, you may not use variables or methods starting with an underscore (init is allowed, but iterate for example, is not).
Also the type() and hassattribute() functions are missing/disallowed for unknown reasons.
Long story short, I got around all those restrictions and seem to have the code working for the most part.
Except for one problem:
There seems to be a problem with the authentication that I've introduced as a side-effect.
The only changes that might seem relevant are the type checks which I've replaced with isinstance and the hasattr checks which I've replaced by a series of try ... except ... blocks
My code can be found here:
I've really reached a dead end here.
It seems like this only affects the deserialization process.
If I dump the challenge string and run it through a second, unmodified copy of the code, both generate the same digest from it.
Still, though, I've got no idea why my modified deserialization code would work any different from the original one.