Skip to content

Latest commit

 

History

History
115 lines (69 loc) · 3.08 KB

README.rst

File metadata and controls

115 lines (69 loc) · 3.08 KB

AEAT-WEB-SERVICES

Master https://travis-ci.org/initios/aeat-web-services.svg?branch=master https://coveralls.io/repos/github/initios/aeat-web-services/badge.svg?branch=master

Spanish Tax Agency Electronic Office (AEAT) Integration


Integración con la Agencia Estatal de Administración Tributaria Española

Purpose

Make requests AEAT Web Services and sign your connection and xml using your certificate. See usage below.


Realiza peticiones a los `Servicios Web de AEAT <https://www2.agenciatributaria.gob.es/ADUA/internet/ws.html>`_ y firma tu conexión y mensajes XML utilizando tu certificado.

Usage

Example for requesting a list of ENS's. Initialize a Config object with the desired preconfigured service and if you want to request AEAT test or production endpoints (test_mode). Finally initialize controller with the config and the desired certificate and make the request with your payload.

If you need more control just build the controller by hand, see build_from_config method for inspiration.


Ejemplo de consulta de ENSs. Inicializa el objecto Config con el servicio preconfigurado y si quieres usar los endpoints de AEAT de test o de producción (test_mode). Por último inicializa el controlador con la config y el certificado que gustes y realiza la petición pasándole los datos que necesites.

Si necesitas un mayor control simplemente construye el controlador a mano, puedes inspirarte en el método build_from_config.

import aeat

config = aeat.Config('ens_query', test_mode=True)
ctrl = aeat.Controller.build_from_config(config, 'key.pem', 'cert.pem')
payload = {'TraModAtBorHEA76': '1', 'ExpDatOfArr': '20110809',  'ConRefNum': '9294408'}
result = ctrl.request(**payload)

assert result.valid, f'Error requesting aeat: {result.data}'
assert result.data is not None

Prerequisites

Install xmlsec prerequisites. Check https://github.com/mehcode/python-xmlsec

Install

$ pip install aeat-web-services

Develop

$ pip install -e .
$ pip install -r requirements_test.txt

Testing

$ pip install tox
$ tox

Changelog

2018-04-01 Release 1.0.0-pre.1 Versión inicial

Usefull Links