courts.tjsp.client.TJSPScraper
courts.tjsp.client.TJSPScraper(=0,
verbose=None,
download_path=0.5,
sleep_time**kwargs,
)
Main scraper for Tribunal de Justica de Sao Paulo.
Methods
Name | Description |
---|---|
cjpg | Orchestrates the download and parsing of processes from CJPG. |
cjpg_download | Downloads the processes from the TJSP jurisprudence. |
cjpg_parse | Wrapper for parsing downloaded files from CJPG. |
cjsg | Orchestrates the download and parsing of processes from CJSG. |
cjsg_download | Downloads the HTML files of the pages of results of the |
cjsg_parse | Wrapper for parsing downloaded files from CJSG. |
cpopg | Scrapes a process from Primeiro Grau (CPOPG). |
cpopg_download | Downloads a process from Primeiro Grau (CPOPG). |
cpopg_parse | Wrapper for parsing downloaded files from CPOPG. |
cposg | Orchestrates the download and parsing of processes from Segundo Grau (CPOSG). |
cposg_download | Downloads processes from Segundo Grau (CPOSG), via HTML or API, using modularized functions. |
cposg_parse | Wrapper for parsing downloaded files from CPOSG. |
set_download_path | Sets the base directory for saving downloaded files. |
set_method | Sets the method for accessing TJSP data. |
cjpg
courts.tjsp.client.TJSPScraper.cjpg(='',
pesquisa=None,
classes=None,
assuntos=None,
varas=None,
id_processo=None,
data_inicio=None,
data_fim=None,
paginas )
Orchestrates the download and parsing of processes from CJPG.
Parameters
Name | Type | Description | Default |
---|---|---|---|
pesquisa | str | The search term. Default is “” (empty string). | '' |
classes | list[str] | List of classes of the process. Default is None. | None |
assuntos | list[str] | List of subjects of the process. Default is None. | None |
varas | list[str] | List of varas of the process. Default is None. | None |
id_processo | str | ID of the process. Default is None. | None |
data_inicio | str | Start date of the search. Default is None. | None |
data_fim | str | End date of the search. Default is None. | None |
paginas | range | Range of pages to download. Default is None. | None |
cjpg_download
courts.tjsp.client.TJSPScraper.cjpg_download(
pesquisa,=None,
classes=None,
assuntos=None,
varas=None,
id_processo=None,
data_inicio=None,
data_fim=None,
paginas )
Downloads the processes from the TJSP jurisprudence.
Parameters
Name | Type | Description | Default |
---|---|---|---|
pesquisa | str | The search term. | required |
classes | list[str] | List of classes of the process. Default is None. | None |
assuntos | list[str] | List of subjects of the process. Default is None. | None |
varas | list[str] | List of varas of the process. Default is None. | None |
id_processo | str | ID of the process. Default is None. | None |
data_inicio | str | Start date of the search. Default is None. | None |
data_fim | str | End date of the search. Default is None. | None |
paginas | range | Pages to download. Default is None. | None |
cjpg_parse
courts.tjsp.client.TJSPScraper.cjpg_parse(path)
Wrapper for parsing downloaded files from CJPG.
cjsg
courts.tjsp.client.TJSPScraper.cjsg(
pesquisa,=None,
ementa=None,
classe=None,
assunto=None,
comarca=None,
orgao_julgador=None,
data_inicio=None,
data_fim=True,
baixar_sg='acordao',
tipo_decisao=None,
paginas )
Orchestrates the download and parsing of processes from CJSG.
cjsg_download
courts.tjsp.client.TJSPScraper.cjsg_download(
pesquisa,=None,
ementa=None,
classe=None,
assunto=None,
comarca=None,
orgao_julgador=None,
data_inicio=None,
data_fim=True,
baixar_sg='acordao',
tipo_decisao=None,
paginas )
Downloads the HTML files of the pages of results of the Second Stage Judgment Consultation (CJSG).
Parameters
Name | Type | Description | Default |
---|---|---|---|
pesquisa | str | Search term. | required |
ementa | str | Filter by text of the ementa. | None |
classe | str | None | Class of the process. | None |
assunto | str | None | Subject of the process. | None |
comarca | str | None | Court of the process. | None |
orgao_julgador | str | None | Court of appeal of the process. | None |
data_inicio | str | None | Start date of the process. | None |
data_fim | str | None | End date of the process. | None |
baixar_sg | bool | If True, also downloads from Second Stage. | True |
tipo_decisao | str | ‘acordao’ or ‘monocratica’. | 'acordao' |
paginas | range | Range of pages to download. | None |
NOTE: range(0, n) downloads pages 1 to n (inclusive), following the user’s expectation (example: range(0,3) downloads pages 1, 2 and 3).
cjsg_parse
courts.tjsp.client.TJSPScraper.cjsg_parse(path)
Wrapper for parsing downloaded files from CJSG.
cpopg
='html') courts.tjsp.client.TJSPScraper.cpopg(id_cnj, method
Scrapes a process from Primeiro Grau (CPOPG).
cpopg_download
='html') courts.tjsp.client.TJSPScraper.cpopg_download(id_cnj, method
Downloads a process from Primeiro Grau (CPOPG).
Parameters
Name | Type | Description | Default |
---|---|---|---|
id_cnj | Union[str, List[str]] | string with the CNJ of the process, or list of strings with CNJs. | required |
method | Literal['html', 'api'] | Literal[‘html’, ‘api’]. The methods supported are ‘html’ and ‘api’. The default is ‘html’. | 'html' |
Raises
Name | Type | Description |
---|---|---|
Exception | If the method passed as parameter is not ‘html’ or ‘api’. |
cpopg_parse
courts.tjsp.client.TJSPScraper.cpopg_parse(path)
Wrapper for parsing downloaded files from CPOPG.
cposg
='html') courts.tjsp.client.TJSPScraper.cposg(id_cnj, method
Orchestrates the download and parsing of processes from Segundo Grau (CPOSG).
cposg_download
='html') courts.tjsp.client.TJSPScraper.cposg_download(id_cnj, method
Downloads processes from Segundo Grau (CPOSG), via HTML or API, using modularized functions.
cposg_parse
courts.tjsp.client.TJSPScraper.cposg_parse(path)
Wrapper for parsing downloaded files from CPOSG.
set_download_path
=None) courts.tjsp.client.TJSPScraper.set_download_path(path
Sets the base directory for saving downloaded files.
Parameters
Name | Type | Description | Default |
---|---|---|---|
path | str | Path to save downloaded files. Default is None (uses temporary directory). | None |
set_method
courts.tjsp.client.TJSPScraper.set_method(method)
Sets the method for accessing TJSP data.
Parameters
Name | Type | Description | Default |
---|---|---|---|
method | Literal['html', 'api'] | Literal[‘html’, ‘api’]. The methods supported are ‘html’ and ‘api’. | required |
Raises
Name | Type | Description |
---|---|---|
Exception | If the method is not ‘html’ or ‘api’. |