Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloCastellano committed Mar 11, 2017
1 parent 755e71f commit 1212777
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion bormeparser/borme.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,12 @@ def _to_dict(self, set_url=True):

def to_json(self, path=None, overwrite=True, pretty=True, include_url=True):
"""
Incluir la URL es opcional porque requiere conexión a Internet
Genera BORME-JSON a partir del archivo PDF
Nota: Requiere conexión a Internet si include_url=True
path: directorio o archivo
overwrite: Sobreescribe el archivo si ya existe
pretty: Genera el BORME-JSON con indentación para que sea más legible
include_url: Incluir la URL para descargar el BORME de su fuente oficial
"""
def set_default(obj):
""" serialize Python sets as lists
Expand Down
9 changes: 8 additions & 1 deletion bormeparser/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ def download_pdf(date, filename, seccion, provincia, parse=False):
# province = class PROVINCIA
# "http://boe.es/borme/dias/2015/06/01/pdfs/BORME-A-2015-101-29.pdf"
def get_url_pdf(date, seccion, provincia, secure=USE_HTTPS):
""" Devuelve la URL para descargar un BORME
Nota: Requiere conexión a Internet
"""
if isinstance(date, tuple):
date = datetime.date(year=date[0], month=date[1], day=date[2])

Expand All @@ -118,6 +121,7 @@ def get_url_pdf(date, seccion, provincia, secure=USE_HTTPS):


def get_url_pdf_from_xml(date, seccion, provincia, xml_path, secure=USE_HTTPS):
""" Devuelve la URL para descargar un BORME """
if isinstance(date, tuple):
date = datetime.date(year=date[0], month=date[1], day=date[2])

Expand All @@ -141,7 +145,10 @@ def get_url_borme_c(date, some_number, format='xml'):
"""

def get_nbo_from_xml(source):
""" Número de Boletín Oficial """
""" Devuelve el Número de Boletín Oficial (nbo)
source: url o path
Nota: Requiere conexión a Internet si source es una URL
"""
if source.startswith('http'):
req = requests.get(source)
content = req.text.encode('iso-8859-1')
Expand Down

0 comments on commit 1212777

Please sign in to comment.