■ INDEX mod_python, 194 Qpid, 131 Thrift, 320 APIs. See also RPC (Remote Procedure Call) systems Google Maps example, 2-7 parsing HTML elements, 169, 174 POST and, 151 REST, 151, 189, 191 APOP, 235, 237 append(), 261 appending messages, 261 application development, web, 187–92 applications programming, web, 179–96 Applied Cryptography, 92 as_string(), 206 ASCII encoding, 71, 72 mode in FTP, 294, 297 asynchat, 115 asynchronous file transfer, 287, 288 IMAP actions, 261 JSON-RPC support, 315 asynchronous services, 114. See also event-driven servers asyncore, 115 attachment (), 207 attachments, MIME. 205, 213, 214 auth_handler, 157 Authenticated SMTP, 232 authentication e-mail, 219, 221, 232, 245 error messages, 230 FTP, 294, 303 HTTP, 157 Kerberos, 282 POP, 235 rlogin, 279 RPC systems, 307, 319 SMTP, 221, 232 SSH, 282 Telnet, 275 web frameworks, 192 WSGI applications and, 186 AutoAddPolicy, 281 automatic configuration <strong>of</strong> port numbers, 18 automatic program starting, 100 automation, FTP, 293 automation, command-line, 263 avahi service, 70 ■ B back<strong>of</strong>f, exponential, 24–25 backports.ssl_match_hostname, 95 base URLs, 141 base-64 encoding, 205, 207 BaseHTTPServer, 192 Batchelder, Ned, 87 Bcc: header, 222, 259 BeautifulSoup, 163–78 BEFORE search criteria, 260 benchmarking, 106–9 Beowulf clusters, 135 BFG, 190, 193 Bicking, Ian, 186, 264 big-endian computers, 74 binary data conversion, 73–75, 73–75 binary data serialization protocol, 321 binary files downloading, 294–97 uploading, 297–99 binary format in RPC systems, 320 binding address reuse, 42 getaddrinfo(), 56 localhost, 56 socket method, 52 TCP, 39, 43 to external interfaces, 28–29 UDP, 19, 20 blind carbon copy header, 222, 259 blocking deadlock and, 47 framing, 77 non-blocking, 109, 113 in UDP, 23 BODY, 251 324
■ INDEX BODY string search criteria, 260 BODY.PEEK, 251 BODYSTRUCTURE, 256 Bottle, 189 Bottle SimpleTemplate, 188 broadcasting socket option, 31 subnet, 12 UDP, 32 BSON, 80, 151, 320 buffers deadlock in TCP, 44–47 fragmentation in TCP, 39 terminal, 273 build_opener(), 157 bypassing shell arguments, 266 byte strings, 72, 187 bytes byte order, 72, 73–75 vs. octets, 71 ■ C C <strong>Python</strong> threading, 120, 180 CA certificates certfiles.crt file, 96 e-mail and, 233 public keys and, 93, 280 revocation lists, 98 self-signed, 94 verification, 93 Cache-contol: header, 160 caches characteristics, 125 decorator libraries, 128 geographic caching, 155 HTTP, 155 Memcached, 126–29 screen scraping with, 163 canonical names, 57 canonical processing, 273 carbon copy header, 222, 259 carriage-return linefeed sequence, 137 Cascading Style Sheets. See CSS Cc: header, 222, 259 certfiles.crt file, 96 certificate authorities. See CA certificates certificate validation, 233 CGI (Common Gateway Interface), 193 cgi module, 139, 194 CGIHandler, 194 CGIHTTPServer, 193, 194 channels, FTP, 292 channels, SSH, 279, 285 chdir(), 287 Cherokee, 182 CherryPy, 190, 193 children and parents CGI and, 193 HTML elements, 169, 173, 175 chunked encoding, 148 cleartext, security <strong>of</strong>, 90–92 client/server pattern, 17 close_folder(), 251 close(), 42, 48, 299 CLOSE-WAIT, 43 closing sockets in TCP, 48, 299 terminal output, 271 CNAME record type, 67 code tracers, 104–6 codecs package, 72 Cohen, Danny, 74 Comet, 192 command-line, 263–90 automation, 263 buffering, 273 editing, 272 email, 218 expansion, 265 port forwarding, 289 prompts, 271, 272 quoting, 265, 268 SFTP, 286–88 special characters and, 265–69, 272, 277 SSH, 278–89 Telnet, 274–78 terminals and, 270–74 Windows, 269 325
- Page 2 and 3:
Foundations of Python Network Progr
- Page 4 and 5:
To the Python community for creatin
- Page 6 and 7:
Contents ■Contents at a Glance ..
- Page 8 and 9:
■ CONTENTS Asking getaddrinfo() W
- Page 10 and 11:
■ CONTENTS Using Message Queues f
- Page 12 and 13:
■ CONTENTS Parsing Dates ........
- Page 14 and 15:
■ CONTENTS Telnet ...............
- Page 16 and 17:
About the Authors ■ Brandon Craig
- Page 18 and 19:
Acknowledgements This book owes its
- Page 20 and 21:
■ INTRODUCTION If you do know som
- Page 22 and 23:
C H A P T E R 1 ■ ■ ■ Introdu
- Page 24 and 25:
CHAPTER 1 ■ INTRODUCTION TO CLIEN
- Page 26 and 27:
CHAPTER 1 ■ INTRODUCTION TO CLIEN
- Page 28 and 29:
CHAPTER 1 ■ INTRODUCTION TO CLIEN
- Page 30 and 31:
CHAPTER 1 ■ INTRODUCTION TO CLIEN
- Page 32 and 33:
CHAPTER 1 ■ INTRODUCTION TO CLIEN
- Page 34 and 35:
CHAPTER 1 ■ INTRODUCTION TO CLIEN
- Page 36 and 37:
C H A P T E R 2 ■ ■ ■ UDP The
- Page 38 and 39:
CHAPTER 2 ■ UDP server with SSH.
- Page 40 and 41:
CHAPTER 2 ■ UDP them anywhere in
- Page 42 and 43:
CHAPTER 2 ■ UDP command-line argu
- Page 44 and 45:
CHAPTER 2 ■ UDP » » » » raise
- Page 46 and 47:
CHAPTER 2 ■ UDP world itself give
- Page 48 and 49:
CHAPTER 2 ■ UDP socket that is no
- Page 50 and 51:
CHAPTER 2 ■ UDP So binding to an
- Page 52 and 53:
CHAPTER 2 ■ UDP s.connect((hostna
- Page 54 and 55:
CHAPTER 2 ■ UDP else: » print >>
- Page 56 and 57:
C H A P T E R 3 ■ ■ ■ TCP The
- Page 58 and 59:
CHAPTER 3 ■ TCP situation), and t
- Page 60 and 61:
CHAPTER 3 ■ TCP » reply = recv_a
- Page 62 and 63:
CHAPTER 3 ■ TCP guess when the in
- Page 64 and 65:
CHAPTER 3 ■ TCP the system has no
- Page 66 and 67:
CHAPTER 3 ■ TCP » » » print '\
- Page 68 and 69:
CHAPTER 3 ■ TCP $ python tcp_dead
- Page 70 and 71:
CHAPTER 3 ■ TCP Using TCP Streams
- Page 72 and 73:
CHAPTER 4 ■ SOCKET NAMES AND DNS
- Page 74 and 75:
CHAPTER 4 ■ SOCKET NAMES AND DNS
- Page 76 and 77:
CHAPTER 4 ■ SOCKET NAMES AND DNS
- Page 78 and 79:
CHAPTER 4 ■ SOCKET NAMES AND DNS
- Page 80 and 81:
CHAPTER 4 ■ SOCKET NAMES AND DNS
- Page 82 and 83:
CHAPTER 4 ■ SOCKET NAMES AND DNS
- Page 84 and 85:
CHAPTER 4 ■ SOCKET NAMES AND DNS
- Page 86 and 87:
CHAPTER 4 ■ SOCKET NAMES AND DNS
- Page 88 and 89:
CHAPTER 4 ■ SOCKET NAMES AND DNS
- Page 90 and 91:
CHAPTER 4 ■ SOCKET NAMES AND DNS
- Page 92 and 93:
CHAPTER 5 ■ NETWORK DATA AND NETW
- Page 94 and 95:
CHAPTER 5 ■ NETWORK DATA AND NETW
- Page 96 and 97:
CHAPTER 5 ■ NETWORK DATA AND NETW
- Page 98 and 99:
CHAPTER 5 ■ NETWORK DATA AND NETW
- Page 100 and 101:
CHAPTER 5 ■ NETWORK DATA AND NETW
- Page 102 and 103:
CHAPTER 5 ■ NETWORK DATA AND NETW
- Page 104 and 105:
CHAPTER 5 ■ NETWORK DATA AND NETW
- Page 106 and 107:
C H A P T E R 6 ■ ■ ■ TLS and
- Page 108 and 109:
CHAPTER 6 ■ TLS AND SSL systems a
- Page 110 and 111:
CHAPTER 6 ■ TLS AND SSL • He wi
- Page 112 and 113:
CHAPTER 6 ■ TLS AND SSL discussio
- Page 114 and 115:
CHAPTER 6 ■ TLS AND SSL • The s
- Page 116 and 117:
CHAPTER 6 ■ TLS AND SSL The Links
- Page 118 and 119:
C H A P T E R 7 ■ ■ ■ Server
- Page 120 and 121:
CHAPTER 7 ■ SERVER ARCHITECTURE P
- Page 122 and 123:
CHAPTER 7 ■ SERVER ARCHITECTURE
- Page 124 and 125:
CHAPTER 7 ■ SERVER ARCHITECTURE N
- Page 126 and 127:
CHAPTER 7 ■ SERVER ARCHITECTURE L
- Page 128 and 129:
CHAPTER 7 ■ SERVER ARCHITECTURE F
- Page 130 and 131:
CHAPTER 7 ■ SERVER ARCHITECTURE
- Page 132 and 133:
CHAPTER 7 ■ SERVER ARCHITECTURE p
- Page 134 and 135:
CHAPTER 7 ■ SERVER ARCHITECTURE N
- Page 136 and 137:
CHAPTER 7 ■ SERVER ARCHITECTURE L
- Page 138 and 139:
CHAPTER 7 ■ SERVER ARCHITECTURE
- Page 140 and 141:
CHAPTER 7 ■ SERVER ARCHITECTURE s
- Page 142 and 143:
CHAPTER 7 ■ SERVER ARCHITECTURE c
- Page 144 and 145:
C H A P T E R 8 ■ ■ ■ Caches,
- Page 146 and 147:
CHAPTER 8 ■ CACHES, MESSAGE QUEUE
- Page 148 and 149:
CHAPTER 8 ■ CACHES, MESSAGE QUEUE
- Page 150 and 151:
CHAPTER 8 ■ CACHES, MESSAGE QUEUE
- Page 152 and 153:
CHAPTER 8 ■ CACHES, MESSAGE QUEUE
- Page 154 and 155:
CHAPTER 8 ■ CACHES, MESSAGE QUEUE
- Page 156 and 157:
C H A P T E R 9 ■ ■ ■ HTTP Th
- Page 158 and 159:
CHAPTER 9 ■ HTTP Here, the URL sp
- Page 160 and 161:
CHAPTER 9 ■ HTTP Relative URLs Ve
- Page 162 and 163:
CHAPTER 9 ■ HTTP From now on, I a
- Page 164 and 165:
CHAPTER 9 ■ HTTP • 303 See Othe
- Page 166 and 167:
CHAPTER 9 ■ HTTP You cannot tell
- Page 168 and 169:
CHAPTER 9 ■ HTTP Instead of stuff
- Page 170 and 171:
CHAPTER 9 ■ HTTP POST And APIs Al
- Page 172 and 173:
CHAPTER 9 ■ HTTP Content Type Neg
- Page 174 and 175:
CHAPTER 9 ■ HTTP HTTP Caching Man
- Page 176 and 177:
CHAPTER 9 ■ HTTP If the connectio
- Page 178 and 179:
CHAPTER 9 ■ HTTP >>> import cooki
- Page 180 and 181:
CHAPTER 9 ■ HTTP So the technique
- Page 182 and 183:
C H A P T E R 10 ■ ■ ■ Screen
- Page 184 and 185:
CHAPTER 10 ■ SCREEN SCRAPING Figu
- Page 186 and 187:
CHAPTER 10 ■ SCREEN SCRAPING cont
- Page 188 and 189:
CHAPTER 10 ■ SCREEN SCRAPING Thir
- Page 190 and 191:
CHAPTER 10 ■ SCREEN SCRAPING Ther
- Page 192 and 193:
CHAPTER 10 ■ SCREEN SCRAPING Beau
- Page 194 and 195:
CHAPTER 10 ■ SCREEN SCRAPING If y
- Page 196 and 197:
CHAPTER 10 ■ SCREEN SCRAPING Cond
- Page 198 and 199:
C H A P T E R 11 ■ ■ ■ Web Ap
- Page 200 and 201:
CHAPTER 11 ■ WEB APPLICATIONS Thi
- Page 202 and 203:
CHAPTER 11 ■ WEB APPLICATIONS But
- Page 204 and 205:
CHAPTER 11 ■ WEB APPLICATIONS the
- Page 206 and 207:
CHAPTER 11 ■ WEB APPLICATIONS •
- Page 208 and 209:
CHAPTER 11 ■ WEB APPLICATIONS hig
- Page 210 and 211:
CHAPTER 11 ■ WEB APPLICATIONS The
- Page 212 and 213:
CHAPTER 11 ■ WEB APPLICATIONS the
- Page 214 and 215:
CHAPTER 11 ■ WEB APPLICATIONS The
- Page 216 and 217:
C H A P T E R 12 ■ ■ ■ E-mail
- Page 218 and 219:
CHAPTER 12 ■ E-MAIL COMPOSITION A
- Page 220 and 221:
CHAPTER 12 ■ E-MAIL COMPOSITION A
- Page 222 and 223:
CHAPTER 12 ■ E-MAIL COMPOSITION A
- Page 224 and 225:
CHAPTER 12 ■ E-MAIL COMPOSITION A
- Page 226 and 227:
CHAPTER 12 ■ E-MAIL COMPOSITION A
- Page 228 and 229:
CHAPTER 12 ■ E-MAIL COMPOSITION A
- Page 230 and 231:
CHAPTER 12 ■ E-MAIL COMPOSITION A
- Page 232 and 233:
CHAPTER 12 ■ E-MAIL COMPOSITION A
- Page 234 and 235:
CHAPTER 12 ■ E-MAIL COMPOSITION A
- Page 236 and 237:
C H A P T E R 13 ■ ■ ■ SMTP A
- Page 238 and 239:
CHAPTER 13 ■ SMTP anyway. Outgoin
- Page 240 and 241:
CHAPTER 13 ■ SMTP How SMTP Is Use
- Page 242 and 243:
CHAPTER 13 ■ SMTP This mechanism
- Page 244 and 245:
CHAPTER 13 ■ SMTP s = smtplib.SMT
- Page 246 and 247:
CHAPTER 13 ■ SMTP ETRN STARTTLS X
- Page 248 and 249:
CHAPTER 13 ■ SMTP » s = smtplib.
- Page 250 and 251:
CHAPTER 13 ■ SMTP exchange mail o
- Page 252 and 253:
CHAPTER 13 ■ SMTP username = sys.
- Page 254 and 255:
C H A P T E R 14 ■ ■ ■ POP PO
- Page 256 and 257:
CHAPTER 14 ■ POP ■ Caution! Whi
- Page 258 and 259:
CHAPTER 14 ■ POP finally: » p.qu
- Page 260 and 261:
CHAPTER 14 ■ POP Subject: Backup
- Page 262 and 263:
CHAPTER 15 ■ IMAP THE IMAP PROTOC
- Page 264 and 265:
CHAPTER 15 ■ IMAP '(\\HasNoChildr
- Page 266 and 267:
CHAPTER 15 ■ IMAP Examining Folde
- Page 268 and 269:
CHAPTER 15 ■ IMAP Listing 15-5. D
- Page 270 and 271:
CHAPTER 15 ■ IMAP key that IMAP h
- Page 272 and 273:
CHAPTER 15 ■ IMAP » » print def
- Page 274 and 275:
CHAPTER 15 ■ IMAP » From: Brando
- Page 276 and 277:
CHAPTER 15 ■ IMAP • \Flagged: T
- Page 278 and 279:
CHAPTER 15 ■ IMAP An IMAP message
- Page 280 and 281:
CHAPTER 15 ■ IMAP display or summ
- Page 282 and 283:
CHAPTER 16 ■ TELNET AND SSH cloud
- Page 284 and 285:
CHAPTER 16 ■ TELNET AND SSH Unix
- Page 286 and 287:
CHAPTER 16 ■ TELNET AND SSH Do yo
- Page 288 and 289:
CHAPTER 16 ■ TELNET AND SSH As we
- Page 290 and 291: CHAPTER 16 ■ TELNET AND SSH tabif
- Page 292 and 293: CHAPTER 16 ■ TELNET AND SSH repla
- Page 294 and 295: CHAPTER 16 ■ TELNET AND SSH Listi
- Page 296 and 297: CHAPTER 16 ■ TELNET AND SSH def p
- Page 298 and 299: CHAPTER 16 ■ TELNET AND SSH We wi
- Page 300 and 301: CHAPTER 16 ■ TELNET AND SSH • p
- Page 302 and 303: CHAPTER 16 ■ TELNET AND SSH You w
- Page 304 and 305: CHAPTER 16 ■ TELNET AND SSH » »
- Page 306 and 307: CHAPTER 16 ■ TELNET AND SSH Listi
- Page 308 and 309: CHAPTER 16 ■ TELNET AND SSH Summa
- Page 310 and 311: CHAPTER 17 ■ FTP The biggest prob
- Page 312 and 313: CHAPTER 17 ■ FTP f.login() print
- Page 314 and 315: CHAPTER 17 ■ FTP if os.path.exist
- Page 316 and 317: CHAPTER 17 ■ FTP f = FTP(host) f.
- Page 318 and 319: CHAPTER 17 ■ FTP Windows servers
- Page 320 and 321: CHAPTER 17 ■ FTP » try: » » f.
- Page 322 and 323: C H A P T E R 18 ■ ■ ■ RPC Re
- Page 324 and 325: CHAPTER 18 ■ RPC sort of proxy ex
- Page 326 and 327: CHAPTER 18 ■ RPC The SimpleXMLRPC
- Page 328 and 329: CHAPTER 18 ■ RPC Traceback (most
- Page 330 and 331: CHAPTER 18 ■ RPC 8.0 If this
- Page 332 and 333: CHAPTER 18 ■ RPC Note that the po
- Page 334 and 335: CHAPTER 18 ■ RPC up being, simply
- Page 336 and 337: CHAPTER 18 ■ RPC such as Python i
- Page 338 and 339: CHAPTER 18 ■ RPC • Google Proto
- Page 342 and 343: ■ INDEX Common Gateway Interface.
- Page 344 and 345: ■ INDEX international characters
- Page 346 and 347: ■ INDEX front-end web servers, 17
- Page 348 and 349: ■ INDEX deleting folders, 260 del
- Page 350 and 351: ■ INDEX mechanize, 138, 163 Memca
- Page 352 and 353: ■ INDEX pausing terminal output,
- Page 354 and 355: ■ INDEX resources. See also RFCs
- Page 356 and 357: ■ INDEX shutdown(), 48 shutting d
- Page 358 and 359: ■ INDEX terminals, 270-74 bufferi
- Page 360 and 361: ■ INDEX ■ V validating cached r