Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • BackTrack 5 R2
  • Wine 1.4 / 1.5.5
  • Mozilla Firefox 12...
  • Ubuntu 11.04
  • Angry Birds 1.1.2.1
  • Ubuntu 10.04.4 LTS
  • Linux Kernel 3.4
  • Ubuntu Manual 10.10
  • Adobe Flash Player...
  • Pidgin 2.10.4
  • Home > Linux > Internet > HTTP (WWW)

    Tornalet 1.0

    Download button

    No screenshots available
    Downloads: 45  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Gawen Arab | More programs
    The Apache License 2.0 / FREE
    February 15th, 2012, 10:11 GMT
    ROOT / Internet / HTTP (WWW)

     Read user reviews (0)  Refer to a friend  Subscribe

    Tornalet description

    Tornado + Greenlet = Beautiful

    Tornado is great, if you can code asynchronously ...

    Greenlet is cool to create asynchronous programs using micro-threads.

    What about a mix of the two? We are proud to present Tornalet.

    Howto

    To install tornalet, you can clone this repository or use PyPI:

    easy_install tornalet
    pip install tornalet


    To enable tornalet, prefix each of your handler's method the decorator @tornalet.tornalet.

    Then decorate with tornalet.asyncify each of your blocking function. This will make your function asynchronous.

    Example

    import tornalet
    import tornado.web
    import random

    URL = "http://chucknorrisfacts.fr/fortunes/fortunes.txt"

    class MainHandler(tornado.web.RequestHandler):
     @tornalet.tornalet
     def get(self):
     http_client = tornado.httpclient.AsyncHTTPClient()

     # Here's the magic : this line is not synchronous.
     facts = tornalet.asyncify(http_client.fetch)(URL).body.split("%")

     fact = facts[random.randrange(len(facts))]

     self.write("%s" % (fact, ))

    ...



    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    asynchronous programs | code asynchronously | Tornado | Greenlet | asynchronous



    HTML code for linking to this page:


    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM