Skip to content

Instantly share code, notes, and snippets.

View jjesusfilho's full-sized avatar
🏠
Working from home

José de Jesus Filho jjesusfilho

🏠
Working from home
View GitHub Profile
@jjesusfilho
jjesusfilho / get_data_ultima_versao_requests.py
Created August 27, 2023 13:53
TPUs com python requests e zeep.
import requests
from lxml import etree
from datetime import datetime
def tpu_get_data_ultima_versao():
body = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sgt="https://www.cnj.jus.br/sgt/sgt_ws.php">
<soapenv:Header/>
<soapenv:Body>
<sgt:getDataUltimaVersao/>
</soapenv:Body>
@jjesusfilho
jjesusfilho / tpu.R
Last active August 26, 2023 23:52
tpus webservice
tpu_ultima_versao <- function(){
url1 <- "https://www.cnj.jus.br/sgt/sgt_ws.php"
corpo <- '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sgt="https://www.cnj.jus.br/sgt/sgt_ws.php">
<soapenv:Header/>
<soapenv:Body>
<sgt:getDataUltimaVersao/>
</soapenv:Body>
@jjesusfilho
jjesusfilho / python-zeep-example.md
Created August 20, 2023 23:02 — forked from FilBot3/python-zeep-example.md
Python Zeep SOAP Example Write Up

Python Zeep SOAP Client

First, we'll look at the SOAP URL and see what Prefixes, Global Elements, Global Types, Bindings, and Services are provided by the SOAP Service.

You can do this by running zeep as a CLI tool.

export WSDL_URL="http://www.dneonline.com/calculator.asmx?WSDL"
python -m zeep $WSDL_URL
@jjesusfilho
jjesusfilho / tjal_baixar_cpopg_par.R
Created August 2, 2023 18:06
Baixa processos do TJAL pelo nome das partes
tjal_baixar_cpopg_par <- function(consulta = NULL,
parametro = NULL,
distribuidor = "-1",
diretorio = ".") {
httr::set_config(httr::config(ssl_verifypeer = FALSE))
url1<-"https://www2.tjal.jus.br/cpopg/search.do?"
url2<- "https://www2.tjal.jus.br/cpopg/trocarPagina.do?"
@jjesusfilho
jjesusfilho / baixar_cjpg.R
Created April 11, 2023 20:49
Esta função está incompleta. Foi criada apenas para exercícios em sala de aula
baixar_cjpg <- function(busca, diretorio){
url <- "http://esaj.tjsp.jus.br/cjpg/pesquisar.do"
query <-
list(
conversationId = "",
dadosConsulta.pesquisaLivre = busca,
tipoNumero = "UNIFICADO",
numeroDigitoAnoUnificado = "",
@jjesusfilho
jjesusfilho / gist:324864d2dd2ab0c6686f39ab1ae11391
Created June 26, 2023 10:19
Tutorial para instalar o airflow
https://towardsdatascience.com/how-to-run-apache-airflow-as-daemon-using-linux-systemd-63a1d85f9702
@jjesusfilho
jjesusfilho / requisicao_tjsp.R
Created April 11, 2023 16:38
Exemplo de requisição do tjsp
## Script para baixar a consulta de julgados de primeiro grau do TJSP
### Url da consulta
x <- "http://esaj.tjsp.jus.br/cjpg/pesquisar.do;jsessionid=BCB24A785FABE7F341130EEC4B9722F7.cjpg2?conversationId=&dadosConsulta.pesquisaLivre=contratos&tipoNumero=UNIFICADO&numeroDigitoAnoUnificado=&foroNumeroUnificado=&dadosConsulta.nuProcesso=&dadosConsulta.nuProcessoAntigo=&classeTreeSelection.values=&classeTreeSelection.text=&assuntoTreeSelection.values=&assuntoTreeSelection.text=&agenteSelectedEntitiesList=&contadoragente=0&contadorMaioragente=0&cdAgente=&nmAgente=&dadosConsulta.dtInicio=&dadosConsulta.dtFim=&varasTreeSelection.values=&varasTreeSelection.text=&dadosConsulta.ordenacao=DESC"
### Pacotes necesários
library(httr)
remotes::install_github("courtsbr/JurisMiner") ## Paço desnecessário se já instalou
@jjesusfilho
jjesusfilho / cjsg.R
Last active March 29, 2023 15:03
Coleta e organização da jurisprudência do TJSP
### Instale o pacote remotes
install.packages("remotes")
## Instale também o pacote writexl para salvar em excel.
install.packages("writexl")
### Use o pacote remotes para instalar o pacote tjsp:
@jjesusfilho
jjesusfilho / infanticidio_regex.R
Created March 2, 2023 10:17
Usando mutate e stringr na base infanticídio
# Esta atividade irá combinar os conhecimentos obtidos nesta unidade com aqueles obtidos na unidade anterior.
# Uma importante tarefa jurimétrica é gerar novas colunas a partir da identificação de padrões em outras.
# Além disso, gerar sumários estatísticos oferece bons insights sobre os dados à mão.
# Iremos usar a mesma base que utilizamos nas duas unidades anteriores. Se achar mais conveniente, você pode obtê-la da seguinte forma:
cjsg <- jsonlite::fromJSON("https://gist.githubusercontent.com/jjesusfilho/f140fe3808e8d2dc6c920e1629b1ae1b/raw/46163ac97f48b95ffc0afdbc2804f92765ec56a6/infanticidio.json")
## Carregue os pacotes do tidyverse
@jjesusfilho
jjesusfilho / infanticidio_dplyr.R
Last active March 2, 2023 09:22
Exercícios unyleya dplyr
# Utilize o mesmo dataframe cjsg obtido na atividade anterior para praticar as atividades abaixo.
# Caso não o tenha mais, colocarei um link para obtê-lo.
#
## Use a linha de código abaixo se você não tem mais os dados
## obtidos na unidade anterior
cjsg <- jsonlite::fromJSON("https://gist.githubusercontent.com/jjesusfilho/f140fe3808e8d2dc6c920e1629b1ae1b/raw/46163ac97f48b95ffc0afdbc2804f92765ec56a6/infanticidio.json")