[Zope] authentication with python program

Miguel Beltran R. yourpadre at gmail.com
Thu Apr 17 16:39:15 EDT 2008


I have this program what open a dtml what return a XML page, but I
have error with permisions:

import urllib, urllib2

pagina = "http://10.28.1.239/bitacoras/alta/estado2.html"
datos = {"btipo":"D",
         "bholo":87654321,
         "bplac":"dd-12345",
         "accion":"alta_gasolina",
}

params=urllib.urlencode(datos)
aut=urllib2.HTTPBasicAuthHandler()
aut.add_password("AFICON", pagina, "myuser", "mypass")
opener=urllib2.build_opener(aut)
urllib2.install_opener(opener)
r=urllib2.urlopen(pagina,params)
print r.read()
r.close()

but returned XML say:
<ajax>
  <accion>alta_gasolina</accion>
               <respuesta>error</respuesta>
        <error_type>Unauthorized</error_type>
        <error_description>You are not allowed to access 'zsql_alta'
in this context</error_description>

  </ajax>

help? how I can send HTTPBasicAuth?

pd. Sorry by my bad english
-- 
________________________________________
Lo bueno de vivir un dia mas
es saber que nos queda un dia menos de vida


More information about the Zope mailing list