| 32 | # |
| 33 | #=============================== |
| 34 | def download_others(): |
| 35 | |
| 36 | cnxn = connect('www.archiecomics.com') |
| 37 | |
| 38 | print "getting: Archie" |
| 39 | |
| 40 | cnxn.request("GET", '/') |
| 41 | |
| 42 | res = cnxn.getresponse() |
| 43 | |
| 44 | p = re.match(re_date, res.getheader("date")) |
| 45 | |
| 46 | comic_path = '/pops_shop/dailycomics/image' + p.group(1) + '.gif' |
| 47 | |
| 48 | #reconnecting since archiecomics.com closes connection after sending response |
| 49 | cnxn = connect('www.archiecomics.com') |
| 50 | |
| 51 | cnxn.request("GET", comic_path) |
| 52 | |
| 53 | res = cnxn.getresponse() |
| 54 | |
| 55 | igot = res.status, res.reason |
| 56 | |
| 57 | if res.status != "200" and res.reason != "OK": |
| 58 | print 'continuing to next comic since i got: ' |
| 59 | print igot |
| 60 | return |
| 61 | |
| 62 | f = open('archie'+"_"+p.group(1)+"_"+p.group(2)+"_"+p.group(3)+".gif", "wb") |
| 63 | |
| 64 | f.write(res.read()) |
| 65 | |
| 66 | f.close() |
| 67 | |
| 68 | print "OK" |
| 69 | |
| 70 | #=============================== |
| 71 | #connect(server) - connect to server |