Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gisce/face_signer
Zeep plugin to sign ~X509 envelopes as FACes wants
https://github.com/gisce/face_signer
hacktoberfest python python2 python3 soap zeep zeep-plugin
Last synced: 1 day ago
JSON representation
Zeep plugin to sign ~X509 envelopes as FACes wants
- Host: GitHub
- URL: https://github.com/gisce/face_signer
- Owner: gisce
- Created: 2017-12-14T10:49:26.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-09T10:07:57.000Z (over 2 years ago)
- Last Synced: 2024-04-13T16:09:42.672Z (7 months ago)
- Topics: hacktoberfest, python, python2, python3, soap, zeep, zeep-plugin
- Language: Python
- Homepage:
- Size: 37.1 KB
- Stars: 1
- Watchers: 19
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# FACe signer
It provides a Zeep plugin desired to patch SOAP envelopes providing a pseudo-X509 WS-Security integration (expected by FACe servers) signing just the soap header.
## Usage
Just create a Zeep client with FACE_signer plugin with the following arguments:
- `certificate` must be an string with the relative path to the PEM file
- `debug` is an optional boolean flag that triggers the stdout printingFACe_signer initialization:
```
FACE_plugin = FACe_signer(
certificate=PEM_CERTIFICATE,
[debug=False]
)
``````
from FACe_signer import FACe_signerimport zeep
FACE_ENVS = {
'staging': "https://se-face-webservice.redsara.es/facturasspp2?wsdl",
'prod': "https://webservice.face.gob.es/facturasspp2?wsdl"
}
OUR_CERT = "certs/our_cert.pem"client = zeep.Client(
FACE_ENVS['prod'],
plugins=[FACe_signer(OUR_CERT)]
)# Use the expected service as usual with zeep
client.service.XXX()```
## How to install
Just install it using pip:
```
$ pip install FACe_signer
```Remember to process the OS requirements (libsecxml development), see [requirements_os.txt](requirements_os.txt)
## How to debug
`debug=True` argument can be passed at FACe_signer initialization to reach a dump of the request and the response of each FACe's interaction.
Also, "normal" debug using python logging can be performed, i.e:
```
import logging.config# Activate DEBUG for zeep transports
logging.config.dictConfig({
'version': 1,
'formatters': {
'verbose': {
'format': '%(name)s: %(message)s'
}
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
},
'loggers': {
'zeep.transports': {
'level': 'DEBUG',
'propagate': True,
'handlers': ['console'],
},
}
})
```