Skip to content

Instantly share code, notes, and snippets.

@kanazux
Last active August 29, 2015 14:26
Show Gist options
  • Save kanazux/c2e153f8e23fd8dfbd01 to your computer and use it in GitHub Desktop.
Save kanazux/c2e153f8e23fd8dfbd01 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# <[email protected]>
#
from SimpleXMLRPCServer import SimpleXMLRPCServer
from xmlrpclib import Binary
server = SimpleXMLRPCServer(('brutus.com.br', 9589), logRequests=True, allow_none=True)
server.register_introspection_functions()
server.register_multicall_functions()
class xmlrpc_funcs:
def get_cliente_info(self,serial,uuid):
clientes = filter(None, open('clientes','r').read().split('\n'))
for cliente in clientes:
if serial == cliente.split(',')[2] and uuid == cliente.split(',')[3]:
return cliente.split(',')
return "Client info not found"
def get_full_list_clients(self):
return open('clientes','r').read()
server.register_instance(xmlrpc_funcs())
try:
print "Use control-C to exit..."
server.serve_forever()
except KeyboardInterrupt:
print "exiting..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment