Skip to content

Commit

Permalink
ALL_PROVINCIAS
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloCastellano committed Jun 7, 2016
1 parent 3e1cb4b commit 7942c0c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions bormeparser/provincia.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,5 @@ def from_title(title):
return getattr(PROVINCIA, title)
except AttributeError:
raise ValueError('InvalidProvince: %s' % title)

ALL_PROVINCIAS = list(filter(lambda x: not x.startswith('__') and x != 'from_title', vars(PROVINCIA)))
6 changes: 3 additions & 3 deletions scripts/download_borme_pdfs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# download_borme_pdfs_A.py - Download BORME A PDF files
# download_borme_pdfs_A.py - Download BORME PDF files
# Copyright (C) 2015-2016 Pablo Castellano <pablo@anche.no>
#
# This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -81,12 +81,12 @@ def download_range(begin, end, directory, seccion, provincia=None):


if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Download BORME A PDF files.')
parser = argparse.ArgumentParser(description='Download BORME PDF files.')
parser.add_argument('-f', '--fromdate', default='today', help='ISO formatted date (ex. 2015-01-01) or "init". Default: today')
parser.add_argument('-t', '--to', default='today', help='ISO formatted date (ex. 2016-01-01). Default: today')
parser.add_argument('-d', '--directory', default=DEFAULT_BORME_ROOT, help='Directory to download files (default is {})'.format(DEFAULT_BORME_ROOT))
parser.add_argument('-s', '--seccion', default=bormeparser.SECCION.A, choices=['A', 'B', 'C'], help='BORME seccion')
parser.add_argument('-p', '--provincia', help='BORME provincia')
parser.add_argument('-p', '--provincia', choices=bormeparser.provincia.ALL_PROVINCIAS, help='BORME provincia')
parser.add_argument('-v', '--verbose', action='store_true', default=False, help='Verbose mode')
args = parser.parse_args()

Expand Down

0 comments on commit 7942c0c

Please sign in to comment.