Skip to main content
  • Book
  • © 2019

Expert Twisted

Event-Driven and Asynchronous Programming with Python

Apress
  • An authoritative guide to the Twisted ecosystem, written by Python community leaders
  • Explains event-driven programming and asynchronous programming with Python
  • Demonstrates how to combine Twisted's many components into a coherent whole

Buy it now

Buying options

eBook USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access

This is a preview of subscription content, log in via an institution to check for access.

Table of contents (13 chapters)

  1. Front Matter

    Pages i-xix
  2. Foundations

    1. Front Matter

      Pages 1-1
    2. An Introduction to Event-Driven Programming with Twisted

      • Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel et al.
      Pages 3-58
    3. An Introduction to Asynchronous Programming with Twisted

      • Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel et al.
      Pages 59-107
    4. Applications with treq and Klein

      • Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel et al.
      Pages 109-154
  3. Projects

    1. Front Matter

      Pages 155-155
    2. Twisted in Docker

      • Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel et al.
      Pages 157-178
    3. Using Twisted as a WSGI Server

      • Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel et al.
      Pages 179-221
    4. Tahoe-LAFS: The Least-Authority File System

      • Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel et al.
      Pages 223-251
    5. Magic Wormhole

      • Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel et al.
      Pages 253-284
    6. Push Data to Browsers and Micro-services with WebSocket

      • Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel et al.
      Pages 285-304
    7. Applications with asyncio and Twisted

      • Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel et al.
      Pages 305-316
    8. Buildbot and Twisted

      • Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel et al.
      Pages 317-338
    9. Twisted and HTTP/2

      • Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel et al.
      Pages 339-363
    10. Twisted and Django Channels

      • Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel et al.
      Pages 365-371
  4. Correction to: Expert Twisted: Event-Driven and Asynchronous Programming with Python

    • Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel et al.
    Pages C1-C1
  5. Back Matter

    Pages 373-382

About this book

Explore Twisted, the Python-based event-driven networking engine, and review several of its most popular application projects. It is written by community leaders who have contributed to many of the projects covered, and share their hard-won insights and experience.

Expert Twisted starts with an introduction to event-driven programming, explaining it in the context of what makes Twisted unique. It shows how Twisted's design emphasizes testability as a solution to common challenges of reliability, debugging, and start-to-finish causality that are inherent in event-driven programming. It also explains asynchronous programming, and the importance of functions, deferreds, and coroutines. It then uses two popular applications, treq and klein, to demonstrate calling and writing Web APIs with Twisted.


The second part of the book dives into Twisted projects, in each case explaining how the project fits into the Twisted ecosystem and what it does, and offers several examples to bring readers up to speed, with pointers to additional resources for more depth. Examples include using Twisted with Docker, as a WSGI container, for file sharing, and more.


What You'll Learn
  • Integrate Twisted and asyncio using adapters
  • Automate software build, test, and release processes with Buildbot
  • Create clients and servers with Autobahn
  • Transfer files with Magic Wormhole
  • Distribute cloud-based file storage with Tahoe LAFS
  • Understand HTTP/2 with Python and Twisted
  • Support for asynchronous tasks using Django Channels



Who This Book Is For


Readers should have some Python experience and understand the essentials of containers and protocols, but need not be familiar with Twisted or the associated projects covered in the book.

Authors and Affiliations

  • Pasadena, USA

    Mark Williams

  • London, UK

    Cory Benfield

  • New York, USA

    Brian Warner, Moshe Zadka, Dustin Mitchell

  • Nice, France

    Kevin Samuel

  • Toulouse, France

    Pierre Tardy

About the authors

The authors of Expert Twisted include leaders in the Python community and core developers of many of the projects covered. 


Mark Williams works on Twisted and helps develop the Python Cryptographic Authority's pure-Python TLS implementation. At eBay and PayPal, he worked on high-performance Python web services (over a billion requests a day!), application and information security, and porting enterprise, Java-only libraries to Python.




Cory Benfield is an open source Python developer heavily involved in the Python HTTP community. He's a Requests core contributor, a urllib3 core contributor, and the lead maintainer of the Hyper Project, a collection of HTTP and HTTP/2 tools for Python. For his sins, he also helps out with the Python Cryptographic Authority on PyOpenSSL.





Brian Warner is a security engineer and software developer, having worked at Mozilla on Firefox Sync, the Add-On SDK, and Persona. He is co-founder of the Tahoe-LAFS distributed secure filesystem, and develops secure storage and communication tools.




Moshe Zadka has been part of the open source community since 1995, made his first core Python contributions in 1998 and is a founding member of the Twisted open source project. He also loves to teach Twisted and Python, having given tutorials at several conferences as well regularly blogging.





Dustin J. Mitchell has contributed to Buildbot and is a member of the TaskCluster team at Mozilla, having also worked on the Release Engineering, Release Operations, and Infrstructure teams.




Pierre Tardy is a Continuous Integration Specialist with Renault Software Labs, and is currently the lead committer for Buildbot

Bibliographic Information

  • Book Title: Expert Twisted

  • Book Subtitle: Event-Driven and Asynchronous Programming with Python

  • Authors: Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel, Pierre Tardy

  • DOI: https://doi.org/10.1007/978-1-4842-3742-7

  • Publisher: Apress Berkeley, CA

  • eBook Packages: Professional and Applied Computing, Apress Access Books, Professional and Applied Computing (R0)

  • Copyright Information: Mark Williams, Cory Benfield, Brian Warner, Moshe Zadka, Dustin Mitchell, Kevin Samuel, Pierre Tardy 2019

  • Softcover ISBN: 978-1-4842-3741-0Published: 07 December 2018

  • eBook ISBN: 978-1-4842-3742-7Published: 07 December 2018

  • Edition Number: 1

  • Number of Pages: XIX, 382

  • Number of Illustrations: 23 b/w illustrations

  • Topics: Python, Programming Languages, Compilers, Interpreters

Buy it now

Buying options

eBook USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access