Created
August 27, 2023 13:53
-
-
Save jjesusfilho/01ade572e8e2ad53bd17b02c054bb7bd to your computer and use it in GitHub Desktop.
TPUs com python requests e zeep.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | |
</soapenv:Envelope>""" | |
url1 = "https://www.cnj.jus.br/sgt/sgt_ws.php" | |
resposta = requests.post(url1, data= body) | |
conteudo = etree.fromstring(resposta.content) \ | |
.find('.//return') \ | |
.text | |
data = datetime.strptime(conteudo, '%d/%m/%Y').date() | |
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from zeep import Client | |
from datetime import datetime | |
def tpu_get_data_ultima_versao(): | |
client = Client(wsdl = "https://www.cnj.jus.br/sgt/sgt_ws.php?wsdl") | |
conteudo = client.service.getDataUltimaVersao() | |
data = datetime.strptime(conteudo, '%d/%m/%Y').date() | |
return data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment