MCPcopy Create free account
hub / github.com/ActiveState/code / download

Function download

recipes/Python/302700_Grab_document_images/recipe-302700.py:8–19  ·  view source on GitHub ↗
(url,fname)

Source from the content-addressed store, hash-verified

6gifre = None
7
8def download(url,fname):
9 try:
10 print "Downloading "+url+" ... ",
11 furl = urllib2.urlopen(url)
12 f = file(fname,'wb')
13 f.write(furl.read())
14 f.close()
15 print "OK"
16 return 1
17 except:
18 print "Failed"
19 return 0
20
21def gifsub(matchobj):
22 return gifre.findall(matchobj.group(0))[0]

Callers 2

grabFunction · 0.70
recipe-302592.pyFile · 0.50

Calls 3

writeMethod · 0.45
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected