<div dir="ltr">Thanks for ur help. But now i am getting an error <br><br><span style="color: rgb(255, 102, 102);">xmlrpclib.ProtocolError: <ProtocolError for localhost:8000/RPC2: 500 Internal Server Error><br><br><br>
</span>Here is my code at <a href="http://privatepaste.com/d81Kut9AFj" target="_blank">http://privatepaste.com/d81Kut9AFj</a><br><br>Any idea what wrong am i doing?<br><br><div class="gmail_quote">On Thu, Sep 11, 2008 at 7:18 AM, Fredrik Lundh <span dir="ltr"><<a href="mailto:fredrik@pythonware.com">fredrik@pythonware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Usman Ajmal wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
And i also fount that a typical system.auth call will look like:<br>
<br>
POST /xmlrpc/clarens_server.py HTTP/1.0<br>
Host: localhost<br></div>
User-Agent: xmlrpclib.py/0.9.9 (by <a href="http://www.pythonware.com" target="_blank">www.pythonware.com</a> <<a href="http://www.pythonware.com" target="_blank">http://www.pythonware.com</a>>)<div class="Ih2E3d">
<br>
<br>
Content-Type: text/xml<br>
Content-Length: 105<br>
AUTHORIZATION: Basic MkhVTm9VazYxbXArVEZLS0dCY2tIRlA3bjVzPQo6RnJvbSBi<br>
<?xml version='1.0'?><br>
<methodCall><br>
<methodName>system.auth</methodName><br>
<br>
<params><br>
</params><br>
</methodCall><br>
<br>
<br>
Problem is that i don't know how do i generate above xml system.auth call. Can anyone please tell me how do call a function, setting the header of the call too?<br>
</div></blockquote>
<br>
you need to plugin a custom transport. see this page for an example:<br>
<br>
<a href="http://www.python.org/doc/lib/xmlrpc-client-example.html" target="_blank">http://www.python.org/doc/lib/xmlrpc-client-example.html</a><br>
<br>
in your case, it should be sufficient to override send_request, e.g. (untested):<br>
<br>
class SecureTransport(xmlrpclib.Transport):<br>
<br>
def set_authorization(self, ustring, text_ucert):<br>
self.authoriation = encodestring(<div class="Ih2E3d"><br>
"%s:%s" % (ustring,text_ucert)<br>
)<br>
<br></div>
def send_request(self, connection, handler, request_body):<br>
connection.putrequest("POST", handler)<br>
connection.putheader("Authorization",<br>
"Basic %s" % self.authorization<br>
)<br>
<br>
and instantiate the transport by doing<br>
<br>
t = SecureTransport()<br>
t.set_authorization(ustring, text_ucert)<br>
<br>
before passing to the server proxy.<br>
<br>
</F><br><font color="#888888">
<br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br></div>