Cliente Python assíncrono para o serviço SOAP oficial do CNES.
Project description
3s-cnes-client
Cliente Python assíncrono para consultar leitos e profissionais nos serviços SOAP públicos do CNES (Cadastro Nacional de Estabelecimentos de Saúde).
O pacote é exclusivamente assíncrono e usa zeep[async] para consumir os
serviços SOAP.
Instalação
pip install 3s-cnes-client
Uso
import asyncio
from async_cnes import CNESClient
async def main():
async with CNESClient() as client:
leitos = await client.leitos("2400737")
profissionais = await client.profissionais("2400737")
print(leitos)
print(profissionais)
asyncio.run(main())
Se preferir fechar o cliente manualmente:
from async_cnes import CNESClient
client = CNESClient()
try:
leitos = await client.leitos("2400737")
finally:
await client.close()
Métodos disponíveis
leitos(cnes: str) -> list[dict]
Consulta os perfis de leitos vinculados ao código CNES informado.
Retorno: uma lista de dicionários contendo as informações de cada perfil de leito.
[
{
"codigo": "96",
"descricao": "SUPORTE VENTILATORIO PULMONAR",
"dataAtualizacao": "2026-05-18T00:00:00",
"quantidadeLeito": 4,
"quantidadeLeitoSUS": 4
},
{
"codigo": "02",
"descricao": "CARDIOLOGIA",
"dataAtualizacao": "2026-05-18T00:00:00",
"quantidadeLeito": 6,
"quantidadeLeitoSUS": 0
}
]
profissionais(cnes: str) -> list[dict]
Consulta os profissionais vinculados ao código CNES informado.
Retorno: uma lista de dicionários contendo o CPF e o CNS de cada profissional ligado ao CNES.
[
{
"CNS": "709809023050097",
"CPF": "413******00"
},
{
"CNS": "708408234337161",
"CPF": "050******35"
},
{
"CNS": "704102842163350",
"CPF": "085******52"
},
{
"CNS": "700509551692756",
"CPF": "116******74"
}
]
Desenvolvimento
python -m pip install -e ".[dev]"
ruff check .
mypy src
pytest
python -m build
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file 3s_cnes_client-0.2.0.tar.gz.
File metadata
- Download URL: 3s_cnes_client-0.2.0.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5019a88ed6f11b87dc7164764c40d493ccf715ec69f2b2f07091b42426233725
|
|
| MD5 |
e6fb06b0cbbf10088a7dbda63a72b54a
|
|
| BLAKE2b-256 |
54899c882890fde52c1e53fbb77e4e4d9cc06e3aad7fff71cb9720376eabe25a
|
Provenance
The following attestation bundles were made for 3s_cnes_client-0.2.0.tar.gz:
Publisher:
publish.yml on 3S-Saude/3s-cnes-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
3s_cnes_client-0.2.0.tar.gz -
Subject digest:
5019a88ed6f11b87dc7164764c40d493ccf715ec69f2b2f07091b42426233725 - Sigstore transparency entry: 1727571742
- Sigstore integration time:
-
Permalink:
3S-Saude/3s-cnes-client@ad471ccdc56ff9c92a52c7851b909994f1fb03d6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/3S-Saude
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ad471ccdc56ff9c92a52c7851b909994f1fb03d6 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file 3s_cnes_client-0.2.0-py3-none-any.whl.
File metadata
- Download URL: 3s_cnes_client-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38c1732af83fcd7c0da8344354c965d7b6af3bd7b845ac0a001db769fe6276de
|
|
| MD5 |
2f9c53849d46200887ffac8a3763ed5a
|
|
| BLAKE2b-256 |
ad6e9ddf710639d130f7eaae65a0ae844fcddb07e32aa37b0cf7cd2ceeec90ee
|
Provenance
The following attestation bundles were made for 3s_cnes_client-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on 3S-Saude/3s-cnes-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
3s_cnes_client-0.2.0-py3-none-any.whl -
Subject digest:
38c1732af83fcd7c0da8344354c965d7b6af3bd7b845ac0a001db769fe6276de - Sigstore transparency entry: 1727572276
- Sigstore integration time:
-
Permalink:
3S-Saude/3s-cnes-client@ad471ccdc56ff9c92a52c7851b909994f1fb03d6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/3S-Saude
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ad471ccdc56ff9c92a52c7851b909994f1fb03d6 -
Trigger Event:
pull_request
-
Statement type: