Jump to content
Fórum Script Brasil
  • 0

Ajuda com XML-RPC


Kaijr

Question

É o seguinte eu e uns amigos estamos recriando um jogo... transformice ! a source do mesmo foi liberada na verçao mais antiga só que sem sua data base!

Ai vem minha duvida...

XMLRPC se comunica com que tipo de database ?

Como criar uma database que possa ser acessado pelo XMLRPC ?

Como saber que tables criar pelo codigo ? onde é definido ? codigo:

#from http://www.acooke.org/cute/BasicHTTPA0.html
class VerifyingXMLRPCServer(SimpleXMLRPCServer):
    def __init__(self, *args, **kargs):
        # we use an inner class so that we can call out to the
        # authenticate method
        class VerifyingRequestHandler(SimpleXMLRPCRequestHandler):
            # this is the method we must override
            def parse_request(myself):
                # first, call the original implementation which returns
                # True if all OK so far
                if SimpleXMLRPCRequestHandler.parse_request(myself):
                    # next we authenticate
                    if self.authenticate(myself.headers):
                        return True
                    else:
                        # if authentication fails, tell the client
                        myself.send_error(401, 'Authentication failed')
                        return False
        # and intialise the superclass with the above
        SimpleXMLRPCServer.__init__(self, requestHandler=VerifyingRequestHandler, *args, **kargs)

    def authenticate(self, headers):
        basic, _, encoded = headers.get('Authorization').partition(' ')
        assert basic == 'Basic', 'Only basic authentication supported'
        username, _, password = base64.b64decode(encoded).partition(':')

        return username.lower() in ADMIN_NAMES and hashlib.sha256(password).hexdigest() == ADMIN_HASH

if __name__ == "__main__":
    TEST = False
    server = TransformiceServer()

    adminTools = TransformiceAdminTools(server)

    rpcServer = VerifyingXMLRPCServer(('', 1110), allow_none=True)
    rpcServer.register_introspection_functions()
    rpcServer.register_instance(adminTools, True)
    thread.start_new_thread(rpcServer.serve_forever, ())

    asyncore.loop()

Não precissa falar tudo pra mim só me explica onde eu faço oque ? como saber oque criar onde demonstra...

Mais uma coisa... me indiquem um tutorial sobre python quero começar na linguagem firme... quero um tuto pra inciantes mesmo!

Grato e desculpas se pedi demais!

Edited by Kaijr
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...