{"id":22307955,"url":"https://github.com/akretion/brazil-fiscal-client","last_synced_at":"2025-07-13T10:34:12.452Z","repository":{"id":230648377,"uuid":"779520130","full_name":"akretion/brazil-fiscal-client","owner":"akretion","description":"base SOAP Client for the Brazilian fiscal authority","archived":false,"fork":false,"pushed_at":"2025-06-16T02:02:23.000Z","size":44,"stargazers_count":3,"open_issues_count":4,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-06-16T02:24:19.693Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akretion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-03-30T03:24:18.000Z","updated_at":"2025-06-16T02:02:26.000Z","dependencies_parsed_at":"2025-04-17T16:51:26.466Z","dependency_job_id":null,"html_url":"https://github.com/akretion/brazil-fiscal-client","commit_stats":null,"previous_names":["akretion/brazil-fiscal-client"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/akretion/brazil-fiscal-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akretion%2Fbrazil-fiscal-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akretion%2Fbrazil-fiscal-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akretion%2Fbrazil-fiscal-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akretion%2Fbrazil-fiscal-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akretion","download_url":"https://codeload.github.com/akretion/brazil-fiscal-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akretion%2Fbrazil-fiscal-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265128706,"owners_count":23715627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-03T20:12:40.092Z","updated_at":"2025-07-13T10:34:12.441Z","avatar_url":"https://github.com/akretion.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://github.com/brazil-fiscal-client/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/akretion/brazil-fiscal-client/workflows/tests.yml?query=branch%3Amain)\n[![codecov](https://codecov.io/gh/akretion/brazil-fiscal-client/graph/badge.svg?token=qOwFJXaJJP)](https://codecov.io/gh/akretion/brazil-fiscal-client)\n[![PyPI](https://img.shields.io/pypi/v/brazil-fiscal-client)](https://pypi.org/project/brazil-fiscal-client)\n\n# brazil-fiscal-client\n\nA simple, modern and well tested SOAP client for the Brazilian Fiscal Authority.\n\nThis client is designed to be inherited by specialized clients such as for electronic\ninvoicing (NFe). But with some extra boiler plate code to deal with the SOAP enveloppe,\nit can still be used alone as you can see in the usage section below.\n\nIt uses [xsdata](https://github.com/tefra/xsdata) for the\n[databinding](https://xsdata.readthedocs.io/en/latest/data_binding/basics/) and it\noverrides its SOAP\n[client](https://xsdata.readthedocs.io/en/latest/codegen/wsdl_modeling/#client)\n\n## Installation\n\n`pip install brazil-fiscal-client`\n\n## Usage\n\nFor instance, with an appropriate pkcs12 certificate, you can query the NFe server\nstatus (remember specialized clients make all this simpler):\n\n```python\n\nfrom brazil_fiscal_client.fiscal_client import FiscalClient\nfrom tests.fixtures.nfestatusservico4 import NfeStatusServico4SoapNfeStatusServicoNf\nfrom nfelib.nfe.bindings.v4_0.cons_stat_serv_v4_00 import ConsStatServ\nfrom nfelib.nfe.bindings.v4_0.ret_cons_stat_serv_v4_00 import RetConsStatServ\n\nambiente = \"2\"\npath_to_your_pkcs12_certificate = \"/path_to_your_certificate/pkcs12_certificate.p12\"\ncertificate_password = \"your_certificate_password\"\n\nwith open(path_to_your_pkcs12_certificate, \"rb\") as pkcs12_buffer:\n    pkcs12_data = pkcs12_buffer.read()\n\nclient = FiscalClient(\n    ambiente=ambiente,\n    versao=\"4.00\",\n    pkcs12_data=pkcs12_data,\n    pkcs12_password=your_certificate_password,\n)\n\nresult = client.send(\n    NfeStatusServico4SoapNfeStatusServicoNf,\n    \"https://nfe-homologacao.svrs.rs.gov.br/ws/NfeStatusServico/NfeStatusServico4.asmx\",\n    {\n        \"Body\": {\n            \"nfeDadosMsg\": {\n                \"content\": [\n                    ConsStatServ(\n                        tpAmb=\"2\",\n                        cUF=\"42\",\n                        xServ=\"STATUS\",\n                        versao=\"4.00\",\n                    ),\n                ]\n            }\n        }\n    },\n)\n\n\u003e\u003e\u003e result.body.nfeResultMsg.content[0]\nRetConsStatServ(tpAmb=\u003cTamb.VALUE_2: '2'\u003e, verAplic='SVRS202401251654', cStat='107', xMotivo='Servico SVC em Operacao', cUF=\u003cTcodUfIbge.VALUE_42: '42'\u003e, dhRecbto='2024-04-01T16:18:03-03:00', tMed='1', dhRetorno=None, xObs=None, versao='4.00')\n\u003e\u003e\u003e result.body.nfeResultMsg.content[0].cStat\n'107'\n```\n\nNotice this example uses the `ConsStatServ` and `RetConsStatServ` bindings from\n[nfelib](https://github.com/akretion/nfelib). In this example\n`NfeStatusServico4SoapNfeStatusServicoNf` has been generated from a previously\ndownloaded wsdl file and using the\n[WSDL xsdata generator](https://xsdata.readthedocs.io/en/latest/codegen/wsdl_modeling/).\nAll this is usually done in the specialized clients that override this base\n`brazil-fiscal-client`SOAP client.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakretion%2Fbrazil-fiscal-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakretion%2Fbrazil-fiscal-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakretion%2Fbrazil-fiscal-client/lists"}