Skip to Content
Hands-On Reactive Programming with Python
book

Hands-On Reactive Programming with Python

by Romain Picard
October 2018
Intermediate to advanced
420 pages
10h 26m
English
Packt Publishing
Content preview from Hands-On Reactive Programming with Python

Implementation of the HTTP server driver

The HTTP server driver is implemented as a function. It takes an observable of responses as input and returns an observable of requests (referential drivers are upside down, so inputs are outputs and outputs are input). The base implementation is the following one:

def http_driver(sink, loop):    app = None    runner = None    def on_subscribe(observer):        app = web.Application()        sink.subscribe(            on_next=on_sink_item,            on_error=on_sink_error,            on_completed=on_sink_completed)    return AnonymousObservable(on_subscribe)

When being called, the http_driver function returns an observable, whose subscription function is on_subscribe. The http_driver function declares two variables, app and runner, which will be used in several ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Programming with Design Patterns

Python Programming with Design Patterns

James W. Cooper

Publisher Resources

ISBN: 9781789138726Supplemental Content