have sorted it out. works fine.
def test():
a=davlib.DAV(HOST,PORT)
a.setauth(USERNAME,PASSWORD)
encodedUSERPASS=base64.encodestring(USERNAME+":"+PASSWORD)
responce=a.get(BASE+"/voyager/add_alerts_to_alert_db",{"Authorization":"Basi
c %s"%encodedUSERPASS})
lines= responce.read()
results=open("results.html","w")
results.writelines(lines)
results.close()
test()
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:activepython-admin@;listserv.ActiveState.com]On Behalf Of Gareth
Evans
Sent: 18 October 2002 13:19
To: [EMAIL PROTECTED]
Subject: Authorization header in a http request
bit of a no brainer.
I'm trying to write a script to bulk put and get files from a Zope server
using webdav protocol via davlib.py
I'm trying to get a file and I need to add the authority header
def test():
a=davlib.DAV(HOST,PORT)
a.setauth(USERNAME,PASSWORD)
responce=a.get(BASE+"/voyager/add_alerts_to_alert_db",{"Authorization":(USER
NAME,PASSWORD)})
lines= responce.read()
results=open("results.html","w")
results.writelines(lines)
results.close()
when I check my results I get
Error Type: Unauthorized
Error Value: You are not authorized to access this resource.
Username and password are not correct.
so obviously the syntax of the Authorization value in the dictionary is
wrong although I believe the key is correct.
can anyone tell me the correct syntax or what I'm doing wrong.
Cheers Gareth
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython