courts.tjsp.client.TJSPScraper

courts.tjsp.client.TJSPScraper(
    verbose=0,
    download_path=None,
    sleep_time=0.5,
    **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='',
    classes=None,
    assuntos=None,
    varas=None,
    id_processo=None,
    data_inicio=None,
    data_fim=None,
    paginas=None,
)

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,
    classes=None,
    assuntos=None,
    varas=None,
    id_processo=None,
    data_inicio=None,
    data_fim=None,
    paginas=None,
)

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,
    ementa=None,
    classe=None,
    assunto=None,
    comarca=None,
    orgao_julgador=None,
    data_inicio=None,
    data_fim=None,
    baixar_sg=True,
    tipo_decisao='acordao',
    paginas=None,
)

Orchestrates the download and parsing of processes from CJSG.

cjsg_download

courts.tjsp.client.TJSPScraper.cjsg_download(
    pesquisa,
    ementa=None,
    classe=None,
    assunto=None,
    comarca=None,
    orgao_julgador=None,
    data_inicio=None,
    data_fim=None,
    baixar_sg=True,
    tipo_decisao='acordao',
    paginas=None,
)

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

courts.tjsp.client.TJSPScraper.cpopg(id_cnj, method='html')

Scrapes a process from Primeiro Grau (CPOPG).

cpopg_download

courts.tjsp.client.TJSPScraper.cpopg_download(id_cnj, method='html')

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

courts.tjsp.client.TJSPScraper.cposg(id_cnj, method='html')

Orchestrates the download and parsing of processes from Segundo Grau (CPOSG).

cposg_download

courts.tjsp.client.TJSPScraper.cposg_download(id_cnj, method='html')

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

courts.tjsp.client.TJSPScraper.set_download_path(path=None)

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’.