Skip to content

Commit

Permalink
download_pdfs now returns list of downloaded files
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloCastellano committed Aug 5, 2015
1 parent 2f87752 commit fc6700b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bormeparser/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,23 @@ def download_xml(date, filename):
# TODO: def download_pdfs(date, path, provincia)
def download_pdfs(date, path, seccion):
urls = get_url_pdfs(date, seccion)
files = []

for url in urls.values():
filename = url.split('/')[-1]
full_path = os.path.join(path, filename)
downloaded = download_url(url, full_path)

if downloaded:
files.append(full_path)
logger.debug('Downloaded %s' % filename)
else:
logger.error('Error downloading %s' % url)

#assert os.path.exists(filepdf)
#assert os.path.getsize(filepdf) == int(url.attrib['szBytes'])

return True
return True, files


# date = (year, month, date) or datetime.date
Expand Down

0 comments on commit fc6700b

Please sign in to comment.