Strona domowa GDR!a Tor Hidden Service

V 3.8

Easy XML-RPC via Jabber protocol


What is this code?

This is a set of Python classes that implement XML-RPC using the Jabber protocol as transport. It supports both secure (SSL) and insecure connections.

Elegant and easy to use interfaces for both XML-RPC server and client are available. Both server and client are clients of Jabber protocol and need regular Jabber accounts on any Jabber server - public or private.

How do I use the server?

Use the EasyJabberXMLRPCServer class. Its constructor takes the following arguments: JabberServer = "", JabberUsername = "_serv", JabberPassword = "test", JabberResource="rpcServer", JabberPort = 5223, JabberConnection = "SSL", ConnectionTimeout = 5

  • JabberServer - name of Jabber server where you hold your account
  • JabberUsername - username on the above Jabber server
  • JabberPassword - your dog's name reversed
  • JabberResource - Jabber resource, use any string you want or leave the default "rpcServer"
  • JabberPort - port on which JabberServer listens for incoming connections
  • JabberConnection - type of connection, either "SSL" or "TCP"
  • ConnectionTimeout - in seconds

To register a method to be exported by the server, use the register_function() method. It takes the following arguments: function, name = None

  • function - the function you want to be exported
  • name - name by which you want the function to be accessible, leave it as None if you want to use the name you use locally

In order for the server to start listening, you need to call the serve_forever() method. It takes no arguments.

In short, the whole server setup takes as much as four lines of code:

import EasyJabberXMLRPCServer

def test(number):
    return "dupa" + str(number)

serv = EasyJabberXMLRPCServer()
print serv

And how do I use the client?

Using the client is not too complicated either. Use the class EasyJabberXMLRPCClient. Its constructor takes the following arguments: JabberServer, JabberUsername, JabberPassword, RpcServerJid, JabberResource="rpcClient", JabberPort = 5223, JabberConnection = "SSL", ConnectionTimeout=20

  • JabberServer - Jabber server where you created the client's account (you remember that you need separate accounts for server and client, do you?)
  • JabberUsername - username on the above server
  • JabberPassword - name of your first girlfriend with "666" appended
  • RpcServerJid - XMLRPC server's account (including resource), ServersJabberUsername@ServersJabberServer/ServersJabberResource
  • JabberResource - leave the default "rpcClient" or type whatever you want
  • JabberPort, JabberConnection, ConnectionTimeout - means the same as with the server

After you call the constructor, the class connects to Jabber server and then to XMLRPC server and, if you get no exception, everything was successful and you can call the methods exported by server as if they were client's methods (for example print ClientInstance.test(param1, param2))

So, in three lines of code we have a working client:

import EasyJabberXMLRPCClient

cli = EasyJabberXMLRPCClient(JabberServer="", JabberUsername = "_client", JabberPassword = "test", RpcServerJid = "")
print cli.test(0x29a) # Here the "test" method exported by server is called

# alternatively, you can call methods this way:
print cli.Call("test", (0x29a,))


2006 GDR! -

Sponsored by Cybertronika

Uses by gian paolo ciceri <>

Licence: Dual, GPL + LGPL


URL encoded in QR Code Statystyki: