It looks like the connection was being closed before the response was being read..
try:
connection.request("POST", "/services/auth/login", body, headers)
response = connection.getresponse()
finally:
**connection.close()**
if response.status != 200:
raise Exception, "%d (%s)" % (response.status, response.reason)
**body = response.read()**
sessionKey = ElementTree.XML(body).findtext("./sessionKey")
If you fix it up a little, it will work..
try:
connection.request("POST", "/services/auth/login", body, headers)
response = connection.getresponse()
finally:
**#connection.close()**
print ''
if response.status != 200:
raise Exception, "%d (%s)" % (response.status, response.reason)
**body = response.read()**
**connection.close()**
sessionKey = ElementTree.XML(body).findtext("./sessionKey")
I'm wondering if anyone else has ever used this example 😉
... View more