Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8890957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:37:06+00:00 2026-06-14T22:37:06+00:00

Basically we can call xmlrpc handlers following way: import xmlrpclib s = xmlrpclib.ServerProxy(‘http://remote_host/rpc/’) print

  • 0

Basically we can call xmlrpc handlers following way:

import xmlrpclib
s = xmlrpclib.ServerProxy('http://remote_host/rpc/')
print s.system.listmethods()

In tornado we can integrate it like this:

import xmlrpclib
import tornado.web

s = xmlrpclib.ServerProxy('http://remote_host/rpc/')

class MyHandler(tornado.web.RequestHandler):
    def get(self):
        result = s.system.listmethods()

I have following, a little bit newbie, questions:

  1. Will result = s.system.listmethods() block tornado?
  2. Are there any non-blocking xmlrpc clients around?
  3. How can we achieve result = yield gen.Task(s.system.listmethods)?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:37:07+00:00Added an answer on June 14, 2026 at 10:37 pm

    1.Yes it will block tornado, since xmlrpclib uses blocking python sockets (as it is)

    2.Not that I’m aware of, but I’ll provide a solution where you can keep xmlrpclib but have it async

    3.My solution doesn’t use tornado gen.

    Ok, so one useful library to have at mind whenever you’re doing networking and need to write async code is gevent, it’s a really good high quality library that I would recommend to everyone.

    Why is it good and easy to use ?

    • You can write asynchronous code in a synchronous manner (so that makes it easy)
    • All you have to do, to do so is monkey patch with one simple line :

      from gevent import monkey; monkey.patch_all()

    When using tornado you need to know two things (that you may already know) :

    • Tornado only supports asynchronous views when acting as a HTTPServer (WSGI isn’t supported for async views)
    • Async views need to terminate the responses by themselves you do by using either self.finish() or self.render() (which calls self.finish())

    Ok so here’s an example illustrating what you would need with the necessary gevent integration with tornado :

    # Python immports
    import functools
    
    # Tornado imports
    import tornado.ioloop
    import tornado.web
    import tornado.httpserver
    
    # XMLRpc imports
    import xmlrpclib
    
    
    # Asynchronous gevent decorator
    def gasync(func):
        @tornado.web.asynchronous
        @functools.wraps(func)
        def f(self, *args, **kwargs):
            return gevent.spawn(func, self, *args, **kwargs)
        return f
    
    
    # Our XML RPC service
    xml_service = xmlrpclib.ServerProxy('http://remote_host/rpc/')
    
    
    class MyHandler(tornado.web.RequestHandler):
        @gasync
        def get(self):
            # This doesn't block tornado thanks to gevent
            # Which patches all of xmlrpclib's socket calls
            # So they no longer are blocking
            result = xml_service.system.listmethods()
    
            # Do something here
    
            # Write response to client
            self.write('hello')
            self.finish()
    
    
    # Our URL Mappings
    handlers = [
       (r"/", MyHandler),
    ]
    
    
    def main():
        # Setup app and HTTP server
        application = tornado.web.Application(handlers)
        http_server = tornado.httpserver.HTTPServer(application)
        http_server.listen(8000)
    
        # Start ioloop
        tornado.ioloop.IOLoop.instance().start()
    
    
    if __name__ == "__main__":
        main()
    

    So give the example a try (adapt it to your needs obviously) and you should be good to go.

    No need to write any extra code, gevent does all the work of patching up python sockets so they can be used asynchronously while still writing code in a synchronous fashion (which is a real bonus).

    Hope this helps 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My problem can be reduced to basically the following set of entities : I
I basically want a method I can call that will set a boolean to
Basically, I want a function I can call which lets me iterate in a
Basically can I do the following... var obj = {}: obj.falsey = true; if(obj){
Is there any way so that you can call a function with a variable?
Is there a way I can call an operator overload in C++ and call
Basically: Can my model classes contain @NoBinding annotations with multiple values? If I have
In prototypal languages object can basically clone each other. So, lets say we have
I keep reading that object-oriented programming can basically be done in any programming language,
I want to make a site where there user can basically navigate the web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.