Functional Python Programming
A Functional Approach to Web Services Injecting a state via cookies The addition of cookies changes the overall relationship bet ...
Chapter 15 However, this is impractical. It turns out that an HTTP request isn't a simple, monolithic data structure. It actuall ...
A Functional Approach to Web Services Nesting the services We can look at web request handling as a number of nested contexts. A ...
Chapter 15 This concept points toward a functional design for creating web content via a nested collection of functions that pro ...
A Functional Approach to Web Services Here's a very simple routing application: SCRIPT_MAP = { ""demo"": demo_app, ""static"": s ...
Chapter 15 We can define a WSGI application that provides static content as follows: def static_app(environ, start_response): tr ...
A Functional Approach to Web Services Pragmatic WSGI applications The intent of the WSGI standard is not to define a complete we ...
Chapter 15 Defining web services as functions We'll look at a RESTful web service, which can "slice and dice" a source of data a ...
A Functional Approach to Web Services Creating the WSGI application First, we'll use a simple URL pattern-matching expression to ...
Chapter 15 This will ensure that our routing works as expected. It's important to be able to test this separately from the rest ...
A Functional Approach to Web Services This application will extract two pieces of information from the request: the PATH_ INFO a ...
Chapter 15 with open(""Anscombe.txt"") as source: data = tuple(head_map_filter(row_iter(source))) mapping = dict((id_str, tuple( ...
A Functional Approach to Web Services (Pair(x=10.0, y=9.14), Pair(x=8.0, y=8.14), Pair(x=13.0, y=8.74), """""" return raw_data[s ...
Chapter 15 """"""json/xml/csv/html serialization. data = [Pair(2,3), Pair(5,7)] serialize(""json"", ""test"", data) ...
A Functional Approach to Web Services 'json': ('application/json', to_bytes(serialize_json)), 'csv': ('text/csv', to_bytes(seria ...
Chapter 15 data = [Pair(2,3), Pair(5,7)] serialize_csv(""test"", data) b'x,y\r\n2,3\r\n5,7\r\n' """""" buffer= io.St ...
A Functional Approach to Web Services x.text= str(row.x) y= XML.SubElement(row_xml, ""y"") y.text= str(row.y) return XML.tostrin ...
Chapter 15 text= data_page.substitute(title=series, rows=""\n"".join( ""{0.x}{0.y}"".format(row) for row in data) ) return text ...
A Functional Approach to Web Services One easy way to create API Keys is to use a cryptographic random number to generate a diff ...
Chapter 15 The RESTful web server will then need a small database with the valid keys and perhaps some client contact informatio ...
«
10
11
12
13
14
15
16
17
18
19
»
Free download pdf