Skip to main content

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 cnes_client import CNESClient


async def main():
    async with CNESClient() as client:
        leitos = await client.leitos("4013484")
        profissionais = await client.profissionais("4013484")

        print(leitos)
        print(profissionais)


asyncio.run(main())

Se preferir fechar o cliente manualmente:

from cnes_client import CNESClient

client = CNESClient()

try:
    leitos = await client.leitos("4013484")
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

3s_cnes_client-0.2.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

3s_cnes_client-0.2.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file 3s_cnes_client-0.2.1.tar.gz.

File metadata

  • Download URL: 3s_cnes_client-0.2.1.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

Hashes for 3s_cnes_client-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d390d60650a1d1277360aacec95e63824733fb0749058024d8b8bd92b46f1f91
MD5 220a22a866c7286cd053fb57540d0027
BLAKE2b-256 e9327c2c62d875c06d93668325668209af065c6b97f65cbcf1e79484941af3e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for 3s_cnes_client-0.2.1.tar.gz:

Publisher: publish.yml on 3S-Saude/3s-cnes-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file 3s_cnes_client-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: 3s_cnes_client-0.2.1-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

Hashes for 3s_cnes_client-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bfb14ba0c24950a7256c2351d85f505b81046a41c431a42f20cbcca23eaf70ac
MD5 525219a1884a30e172f3a45990b66032
BLAKE2b-256 605480386136309c3e9b445448ccb47afeace4f4204041af27c80afb215e6365

See more details on using hashes here.

Provenance

The following attestation bundles were made for 3s_cnes_client-0.2.1-py3-none-any.whl:

Publisher: publish.yml on 3S-Saude/3s-cnes-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page