XML RPC Problem....

Usman Ajmal uzmanajmal at gmail.com
Thu Sep 11 04:32:39 EDT 2008


Thanks for ur help. But now i am getting an error

xmlrpclib.ProtocolError: <ProtocolError for localhost:8000/RPC2: 500
Internal Server Error>


Here is my code at http://privatepaste.com/d81Kut9AFj

Any idea what wrong am i doing?

On Thu, Sep 11, 2008 at 7:18 AM, Fredrik Lundh <fredrik at pythonware.com>wrote:

> Usman Ajmal wrote:
>
>  And i also fount that a typical system.auth call will look like:
>>
>> POST /xmlrpc/clarens_server.py HTTP/1.0
>> Host: localhost
>> User-Agent: xmlrpclib.py/0.9.9 (by www.pythonware.com <
>> http://www.pythonware.com>)
>>
>> Content-Type: text/xml
>> Content-Length: 105
>> AUTHORIZATION: Basic MkhVTm9VazYxbXArVEZLS0dCY2tIRlA3bjVzPQo6RnJvbSBi
>> <?xml version='1.0'?>
>> <methodCall>
>>  <methodName>system.auth</methodName>
>>
>>  <params>
>>  </params>
>> </methodCall>
>>
>>
>> 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?
>>
>
> you need to plugin a custom transport.  see this page for an example:
>
>    http://www.python.org/doc/lib/xmlrpc-client-example.html
>
> in your case, it should be sufficient to override send_request, e.g.
> (untested):
>
>    class SecureTransport(xmlrpclib.Transport):
>
>        def set_authorization(self, ustring, text_ucert):
>            self.authoriation = encodestring(
>                "%s:%s" % (ustring,text_ucert)
>            )
>
>        def send_request(self, connection, handler, request_body):
>            connection.putrequest("POST", handler)
>            connection.putheader("Authorization",
>                "Basic %s" % self.authorization
>            )
>
> and instantiate the transport by doing
>
>    t = SecureTransport()
>    t.set_authorization(ustring, text_ucert)
>
> before passing to the server proxy.
>
> </F>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080911/ba25d0bd/attachment-0001.html>


More information about the Python-list mailing list