Beginning Python - From Novice to Professional
Beginning Python - From Novice to Professional Beginning Python - From Novice to Professional
CHAPTER 15 ■ PYTHON AND THE WEB 339 A Quick Summary As always, new topics were covered—and here they are again: Screen scraping. This is the practice of downloading Web pages automatically, and extracting information from them. The Tidy program and its library version are useful tools for fixing ill-formed HTML before using an HTML parser. Another option is to use Beautiful Soup, which is very forgiving of messy input. CGI. The Common Gateway Interface is a way of creating dynamic Web pages, by making a Web server run and communicate with your programs and display the results. The cgi and cgitb modules are useful for writing CGI scripts. CGI scripts are usually invoked from HTML forms. mod_python. The mod_python handler framework makes it possible to write Apache handlers in Python. It includes three useful standard handlers: the CGI handler, the PSP handler, and the publisher handler. Web services. Web services are to programs what (dynamic) Web pages are to people. You may see them as a way of making it possible to do network programming at a higher level of abstraction. Two example Web service standards discussed in this chapter are RSS and XML-RPC. New Functions in This Chapter Function cgitb.enable() Description Enables tracebacks in CGI scripts What Now? I’m sure you’ve tested the programs you’ve written so far by running them. In the next chapter, you will learn how you can really test them—thoroughly and methodically. Maybe even obsessively, if you’re lucky . . .
- Page 320 and 321: CHAPTER 13 ■ DATABASE SUPPORT 289
- Page 322 and 323: CHAPTER 13 ■ DATABASE SUPPORT 291
- Page 324 and 325: CHAPTER 13 ■ DATABASE SUPPORT 293
- Page 326: CHAPTER 13 ■ DATABASE SUPPORT 295
- Page 329 and 330: 298 CHAPTER 14 ■ NETWORK PROGRAMM
- Page 331 and 332: 300 CHAPTER 14 ■ NETWORK PROGRAMM
- Page 333 and 334: 302 CHAPTER 14 ■ NETWORK PROGRAMM
- Page 335 and 336: 304 CHAPTER 14 ■ NETWORK PROGRAMM
- Page 337 and 338: 306 CHAPTER 14 ■ NETWORK PROGRAMM
- Page 339 and 340: 308 CHAPTER 14 ■ NETWORK PROGRAMM
- Page 341 and 342: 310 CHAPTER 14 ■ NETWORK PROGRAMM
- Page 343 and 344: 312 CHAPTER 14 ■ NETWORK PROGRAMM
- Page 345 and 346: 314 CHAPTER 15 ■ PYTHON AND THE W
- Page 347 and 348: 316 CHAPTER 15 ■ PYTHON AND THE W
- Page 349 and 350: 318 CHAPTER 15 ■ PYTHON AND THE W
- Page 351 and 352: 320 CHAPTER 15 ■ PYTHON AND THE W
- Page 353 and 354: 322 CHAPTER 15 ■ PYTHON AND THE W
- Page 355 and 356: 324 CHAPTER 15 ■ PYTHON AND THE W
- Page 357 and 358: 326 CHAPTER 15 ■ PYTHON AND THE W
- Page 359 and 360: 328 CHAPTER 15 ■ PYTHON AND THE W
- Page 361 and 362: 330 CHAPTER 15 ■ PYTHON AND THE W
- Page 363 and 364: 332 CHAPTER 15 ■ PYTHON AND THE W
- Page 365 and 366: 334 CHAPTER 15 ■ PYTHON AND THE W
- Page 367 and 368: 336 CHAPTER 15 ■ PYTHON AND THE W
- Page 369: 338 CHAPTER 15 ■ PYTHON AND THE W
- Page 373 and 374: 342 CHAPTER 16 ■ TESTING, 1-2-3 P
- Page 375 and 376: 344 CHAPTER 16 ■ TESTING, 1-2-3 T
- Page 377 and 378: 346 CHAPTER 16 ■ TESTING, 1-2-3 T
- Page 379 and 380: 348 CHAPTER 16 ■ TESTING, 1-2-3 R
- Page 381 and 382: 350 CHAPTER 16 ■ TESTING, 1-2-3 d
- Page 383 and 384: 352 CHAPTER 16 ■ TESTING, 1-2-3 B
- Page 385 and 386: 354 CHAPTER 16 ■ TESTING, 1-2-3 >
- Page 388 and 389: CHAPTER 17 ■ ■ ■ Extending Py
- Page 390 and 391: CHAPTER 17 ■ EXTENDING PYTHON 359
- Page 392 and 393: CHAPTER 17 ■ EXTENDING PYTHON 361
- Page 394 and 395: CHAPTER 17 ■ EXTENDING PYTHON 363
- Page 396 and 397: CHAPTER 17 ■ EXTENDING PYTHON 365
- Page 398 and 399: CHAPTER 17 ■ EXTENDING PYTHON 367
- Page 400 and 401: CHAPTER 17 ■ EXTENDING PYTHON 369
- Page 402: CHAPTER 17 ■ EXTENDING PYTHON 371
- Page 405 and 406: 374 CHAPTER 18 ■ PACKAGING YOUR P
- Page 407 and 408: 376 CHAPTER 18 ■ PACKAGING YOUR P
- Page 409 and 410: 378 CHAPTER 18 ■ PACKAGING YOUR P
- Page 411 and 412: 380 CHAPTER 18 ■ PACKAGING YOUR P
- Page 413 and 414: 382 CHAPTER 19 ■ PLAYFUL PROGRAMM
- Page 415 and 416: 384 CHAPTER 19 ■ PLAYFUL PROGRAMM
- Page 417 and 418: 386 CHAPTER 19 ■ PLAYFUL PROGRAMM
- Page 419 and 420: 388 CHAPTER 19 ■ PLAYFUL PROGRAMM
CHAPTER 15 ■ PYTHON AND THE WEB 339<br />
A Quick Summary<br />
As always, new <strong>to</strong>pics were covered—and here they are again:<br />
Screen scraping. This is the practice of downloading Web pages au<strong>to</strong>matically, and<br />
extracting information from them. The Tidy program and its library version are useful<br />
<strong>to</strong>ols for fixing ill-formed HTML before using an HTML parser. Another option is <strong>to</strong> use<br />
Beautiful Soup, which is very forgiving of messy input.<br />
CGI. The Common Gateway Interface is a way of creating dynamic Web pages, by making<br />
a Web server run and communicate with your programs and display the results. The cgi<br />
and cgitb modules are useful for writing CGI scripts. CGI scripts are usually invoked from<br />
HTML forms.<br />
mod_python. The mod_python handler framework makes it possible <strong>to</strong> write Apache<br />
handlers in <strong>Python</strong>. It includes three useful standard handlers: the CGI handler, the PSP<br />
handler, and the publisher handler.<br />
Web services. Web services are <strong>to</strong> programs what (dynamic) Web pages are <strong>to</strong> people. You<br />
may see them as a way of making it possible <strong>to</strong> do network programming at a higher level<br />
of abstraction. Two example Web service standards discussed in this chapter are RSS and<br />
XML-RPC.<br />
New Functions in This Chapter<br />
Function<br />
cgitb.enable()<br />
Description<br />
Enables tracebacks in CGI scripts<br />
What Now?<br />
I’m sure you’ve tested the programs you’ve written so far by running them. In the next chapter,<br />
you will learn how you can really test them—thoroughly and methodically. Maybe even<br />
obsessively, if you’re lucky . . .