It SHA'd work, but doesn't....
Ok,Attempting to get a python script to authticate to PMS for remote libraries. I know that user/pass are passed to PMS as HTTP Headers:
X-Plex-User is lower(username)
X-Plex-Pass is SHA1(lower(username) + SHA1(password))
However I still keep getting 401'd....
I've dumped the network packets and can see that I'm sending the right X-Plex-Pass key (checked against the iOS app) and that I should get back a response.
The only thing I can see is that urllib2 is sending the header as X-plex-pass (i.e. lower case P) rather than X-Plex-Pass. The RFC says that HTTP headers are case insensitive, but i'm wondering. I was going to test with something else (i've been directed towards httplib) - but i'm at home now and can test an external connect.
Any one got any ideas?
Is PMS looking for the correct capitalisation?
Is there any extra debugging I can turn on in PMS?
EDIT: added code for those interested
txheaders = {}<br />
<br />
import sha<br />
msg=sha.new(g_password.lower())<br />
print msg.hexdigest()<br />
msg2=sha.new(g_username.lower()+msg.hexdigest()).hexdigest()<br />
<br />
txheaders['X-Plex-User']=str(g_username.lower())<br />
txheaders['X-Plex-Pass']=str(msg2)<br />
<br />
print "sending header " + str(txheaders)<br />
<br />
req = urllib2.Request(url, txdata, txheaders)<br />