Spanish Tax Agency Electronic Office (AEAT) Integration
Project description
Master |
Spanish Tax Agency Electronic Office (AEAT) Integration.
Make requests AEAT Web Services and sign your connection and xml using your certificate.
Integración con la Agencia Estatal de Administración Tributaria Española
Realiza peticiones a los Servicios Web de AEAT y firma tu conexión y mensajes XML utilizando tu certificado.
Usage (English)
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.
import aeat
config = aeat.Config('ens_query', test_mode=True)
ctrl = aeat.Controller.build_from_config(config, 'cert.pem', 'key.pem')
payload = {'TraModAtBorHEA76': '1', 'ExpDatOfArr': '20110809', 'ConRefNum': '9294408'}
result = ctrl.request(payload)
assert result.valid, f'Error requesting aeat: {result.error}'
assert result.data is not None
Usage (Spanish)
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, 'cert.pem', 'key.pem')
payload = {'TraModAtBorHEA76': '1', 'ExpDatOfArr': '20110809', 'ConRefNum': '9294408'}
result = ctrl.request(payload)
assert result.valid, f'Error requesting aeat: {result.error}'
assert result.data is not None
Prerequisites
Install xmlsec prerequisites. Check https://github.com/mehcode/python-xmlsec
Install
$ pip install aeat-web-services
Develop
$ python setup.py develop
$ pip install -r requirements_test.txt
Test
$ pip install tox
$ tox
Releases
Usefull Links
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file aeat-web-services-1.0.0rc4.tar.gz
.
File metadata
- Download URL: aeat-web-services-1.0.0rc4.tar.gz
- Upload date:
- Size: 48.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d54e3da1d9c940a93d33a878279493244aade2defed88305628220c4d65819a5 |
|
MD5 | 4df8c402b5f451f5b7fe4baa3cac9e1f |
|
BLAKE2b-256 | 289b922b1083273c99ec66244621c0bddf51cff8fd7cf422bac1d62304c5d0ac |
Provenance
File details
Details for the file aeat_web_services-1.0.0rc4-py2.py3-none-any.whl
.
File metadata
- Download URL: aeat_web_services-1.0.0rc4-py2.py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27e7128fff3bcb6ce3c002aea8b3659a3bbce6940a433405c5e5b651e0582687 |
|
MD5 | 2e9e78c72765b3289598561bdeaec020 |
|
BLAKE2b-256 | 5d9afafc61e91f6cfe9f3b4a23def6e5f01cc527ec970ed308a54f0cf21320de |