source code, 218
submit_form() method, 221
robots.txt files, 213
scrape_with_lxml() function, 217
scrape_with_soup() function, 217
spider programs, 213
split() and strip() methods, 218
Terms of Service, 212
tidy program, 217
Web Server Gateway Interface (WSGI)
concentric WSGI wrappers, 171
hostnames, 179–180
HTTP response codes, 178
implementation, 170
low-level socket code, 178
parameters, 170
paths, 179–180
pip installation tool, 180
simple Python function, 170
verbose coding style, 179
WebOb/Web Object library, 180
Werkzeug, 181
World Wide Web
Bottle, 210
Django application, 210
commands, 210
cross-site scripting, 209
CSRF protection, 209
definition, 206
features, 206–207
HTTP POST data, 207
models.py file, 207
ORM, 207
@require_http_methods() call, 209
SQLAlchemy, 208
template tags, 210
urls.py file, 208
views.py file, 208–209
fetchall() method, 192
Flask application, 210
app_insecure.py, 192–193
base.html, 197
HTML templates, 194
Jinja2 template, 195–196
login() and logout() pages, 194
pay() page, 194
Python web application, 194
forms and HTTP methods, 197
app_improved.py payments, 204
cross-site request forgery, 203
GET request, 197
misuse HTTP methods, 199
nonpersistent
cross-site scripting, 201
persistent cross-site scripting, 203
POST/PUT/DELETE method, 197
PyCon scholarships, 198
redirect() constructor, 198
safe and unsafe cookies, 199
techniques, 198
HTML
blanket approach, 188
<br> tag, 188
core standards and resources, 188
CSS and JavaScript, 188
definition, 188
<div>/<span> tag, 188
features, 189
Google Chrome, 189–190
Inspect Element, 190
list element, 188
hypermedia, 183
open_database() function, 191
Pyramid, 211
row.credit and row.dollars, 192
SQLite database, 191
Tornado, 210
URLs
address bar, 183
features, 184
fragment, 184
parsing and building, 184
query string, 184
relative URLs, 186–187
URNs, 184
web scraping (see Web scraping)
WebSockets, 211
wrap_socket() method, 100
X, Y
xpath() method, 218
Z
Zero Message Queue, 144
■ index
357