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

3s_cnes_client-0.2.0.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.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

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

Hashes for 3s_cnes_client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5019a88ed6f11b87dc7164764c40d493ccf715ec69f2b2f07091b42426233725
MD5 e6fb06b0cbbf10088a7dbda63a72b54a
BLAKE2b-256 54899c882890fde52c1e53fbb77e4e4d9cc06e3aad7fff71cb9720376eabe25a

See more details on using hashes here.

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

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

Hashes for 3s_cnes_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38c1732af83fcd7c0da8344354c965d7b6af3bd7b845ac0a001db769fe6276de
MD5 2f9c53849d46200887ffac8a3763ed5a
BLAKE2b-256 ad6e9ddf710639d130f7eaae65a0ae844fcddb07e32aa37b0cf7cd2ceeec90ee

See more details on using hashes here.

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

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