2004-07-31, 18:03
hi python guys..
i need help with the following script! on the pc it works fine, but if i use the script on xbmc it won't work ? any idea?
here is the test script! workinf fine on pc!
but on xbmc i get the following error!
i need help with the following script! on the pc it works fine, but if i use the script on xbmc it won't work ? any idea?
here is the test script! workinf fine on pc!
Quote:import httplib, urllib, base64
ip = '192.168.0.110'
user = 'root'
password = 'blablabla'
def gethttprequest(request,portx, put01): #gethttprequest(requeststring, port':80', setuserpw 0:1 )
conn = httplib.httpconnection(ip+portx)
authhead = "basic %s " % base64.encodestring("%s:%s"%(user, password))
if put01 == '1':
conn.putrequest("get", request)
conn.putheader("authorization", authhead)
conn.endheaders()
else:
conn.request("get", request)
r = conn.getresponse()
print r.status, r.reason, r.msg
data = r.read()
conn.close()
return data
def test():
testx = gethttprequest('/version','','1')
print testx
test()
but on xbmc i get the following error!
Quote:31-07-2004 17:53:00 traceback (most recent call last):
31-07-2004 17:53:00 file "q:\scripts\dreambox-tv\get.py", line 27, in ?
31-07-2004 17:53:00
31-07-2004 17:53:00 test()
31-07-2004 17:53:00
31-07-2004 17:53:00 file "q:\scripts\dreambox-tv\get.py", line 25, in test
31-07-2004 17:53:00
31-07-2004 17:53:00 testx = gethttprequest('/version','','1')
31-07-2004 17:53:00 file "q:\scripts\dreambox-tv\get.py", line 13, in gethttprequest
31-07-2004 17:53:00
31-07-2004 17:53:00 conn.putrequest("get", request)
31-07-2004 17:53:00 file "q:\python\lib\httplib.py", line 667, in putrequest
31-07-2004 17:53:00
31-07-2004 17:53:00 self.putheader('host', self.host.encode("idna"))
31-07-2004 17:53:00 lookuperror
31-07-2004 17:53:00 :
31-07-2004 17:53:00 unknown encoding: idna
31-07-2004 17:53:00