Borme
TheBorme class represents a parsed BORME (Boletín Oficial del Registro Mercantil) document containing commercial registry announcements.
Constructor
The publication date. Can be a
datetime.date object or a tuple (year, month, day).The BORME section (e.g., ‘A’ for acts, ‘C’ for announcements).
The province name or
Provincia object.The BORME bulletin number.
The CVE (verification code) identifier.
List of announcements contained in the BORME.
Path to the source PDF file if loaded from disk.
If
False, sets the URL immediately. Otherwise, URL is computed on demand.Properties
The publication date of this BORME.
The BORME section identifier.
The province for this BORME.
The bulletin number.
The CVE verification code.
Path to the source file if available.
Download URL for the BORME PDF. Computed lazily on first access.
Dictionary mapping announcement IDs to
BormeAnuncio objects.Tuple with the minimum and maximum announcement IDs (from_anuncio, to_anuncio).
Methods
get_anuncio()
The announcement ID number.
The announcement with the specified ID.
BormeAnuncioNotFound if the announcement ID doesn’t exist.
get_anuncios_ids()
Sorted list of announcement IDs.
get_anuncios()
List of all
BormeAnuncio objects.download()
Path where the PDF should be saved.
True if download succeeded.BormeAlreadyDownloadedException if the BORME is already associated with a file.
to_json()
Output path. Can be a directory or file. If
None, uses the filename with .json extension.Whether to overwrite existing files.
Whether to format JSON with indentation for readability.
Whether to include the download URL. Requires internet connection.
Path to the created JSON file, or
False if file exists and overwrite=False.When
include_url=True, this method requires an internet connection to fetch the BORME URL.from_json()
Borme instance from a BORME-JSON file.
Path to a JSON file or an open file object.
A new
Borme instance populated from the JSON data.Usage Examples
Basic usage
Working with announcements
Export to JSON
BormeXML
TheBormeXML class handles the daily BORME summary XML files that list all available BORME PDFs.
Constructor
BormeXML instance. Use the static factory methods from_file() or from_date() to load data.
Properties
The publication date of this BORME XML.
Número de Boletín Oficial (official bulletin number).
Path to the XML file if loaded from disk.
URL of the BORME XML file.
Date of the previous BORME publication.
Date of the next BORME publication, or
None if this is not final.Whether this is the final (definitive) version of the XML.
Factory Methods
from_file()
File path or HTTP(S) URL to the XML file.
Whether to use HTTPS for URLs.
Loaded
BormeXML instance.IOError if file doesn’t exist, BormeDoesntExistException if not a valid BORME XML.
from_date()
Date as a
datetime.date object or tuple (year, month, day).Whether to use HTTPS.
Loaded
BormeXML instance for the specified date.Methods
get_url_pdfs()
Filter by section (e.g., ‘A’, ‘B’, ‘C’). For section C, provincia is ignored.
Filter by province name.
Dictionary mapping CVE/province to PDF URLs. Structure depends on parameters:
- Both specified:
{cve: url} - Only seccion:
{provincia: url} - Only provincia:
{seccion: url}
You must specify at least one of
seccion or provincia.get_cves()
Filter by section.
Filter by province.
List of CVE codes, or single CVE string if only one result.
get_sizes()
Filter by section.
Filter by province.
Dictionary mapping CVE to file size in bytes.
get_url_cve()
The CVE identifier.
Download URL for the BORME PDF.
AttributeError if CVE is not found.
get_provincias()
The section identifier.
List of province names.
download_borme()
Directory where files should be saved.
Province to download.
Section to download.
Tuple of
(success, list_of_downloaded_files).save_to_file()
Output file path. Parent directories are created if needed.
True on success.