PT law downloader is an open source Python package to download the official texts of the Portuguese law.
The authors of this package are Jorge C. Leitão and Helder Guerreiro.
This package is written in Python 3, depends on beautifulSoup 4
(pip install beautifulsoup4
), and is licenced under MIT licence (see LICENCE).
Run the tests with:
python -m unittest discover
Law is organized in documents that contain publications. Its interface is defined by 4 functions:
get_publication(publication_id)
: returns the publicationpublication_id
get_publications(document_id)
: returns the list of publications of adocument_id
. Usesget_publication(publication_id)
.get_document(document_id)
: returns a single dictionary with adocument_id
, which includes all its publications. Usesget_publications(document_id)
.get_documents(series, year)
: returns a list of dictionaries, each entry adocument_id
. Usesget_document(document_id)
.
Typically series is either 'I'
or 'II'
, year is an int (e.g. 2002).