[FIX] tools: zeep, oversight in c111d5cd17a00644a99828848c81ecb6c5b06d22

The module `l10n_nl_reports_sbr` requires
- `zeep.wsdl.utils.get_or_create_header`
- `zeep.ns.*`
- `zeep.wsse.*`

In addition, it requires the `session` to be already
set during the creation of the client.

The module `l10n_pe_edi` requires `requests.Response` as possible
output for service
```py
result = client.service.sendBill
if result.status_code != 500:
    ...
```
Can be tested with
`--test-tags external_l10n:TestEdiSunat`

opw-3887309
opw-3884785
opw-3885630
opw-3870707
opw-3888951
opw-3885636
opw-3885392
opw-3885383
opw-3889366
opw-3888841
This commit is contained in:
Denis Ledoux
2024-04-11 17:13:01 +00:00
parent 4eaea4c374
commit c0905475e3
6 changed files with 17 additions and 14 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
from zeep.transports import Transport
from zeep.plugins import Plugin
from zeep.settings import Settings
from zeep.ns import *
from . import exceptions
from . import ns
from . import wsdl
from .client import Client
+11 -11
View File
@@ -2,11 +2,14 @@ import zeep
from decimal import Decimal
from datetime import date, datetime, timedelta
from requests import Response
from types import SimpleNamespace, FunctionType
TIMEOUT = 30
SERIALIZABLE_TYPES = (type(None), bool, int, float, str, bytes, tuple, list, dict, Decimal, date, datetime, timedelta)
SERIALIZABLE_TYPES = (
type(None), bool, int, float, str, bytes, tuple, list, dict, Decimal, date, datetime, timedelta, Response
)
class Client:
@@ -17,19 +20,16 @@ class Client:
* serializing the returned values of its methods.
"""
def __init__(self, *args, **kwargs):
load_timeout = kwargs.pop('timeout', None)
operation_timeout = kwargs.pop('operation_timeout', None)
session = kwargs.pop('session', None)
transport = kwargs.setdefault('transport', zeep.Transport())
# The timeout for loading wsdl and xsd documents.
transport.load_timeout = kwargs.pop('timeout', None) or transport.load_timeout or TIMEOUT
# The timeout for operations (POST/GET)
transport.operation_timeout = kwargs.pop('operation_timeout', None) or transport.operation_timeout or TIMEOUT
# The `requests.session` used for HTTP requests
transport.session = kwargs.pop('session', None) or transport.session
client = zeep.Client(*args, **kwargs)
# The timeout for loading wsdl and xsd documents.
client.transport.load_timeout = load_timeout or client.transport.load_timeout or TIMEOUT
# The timeout for operations (POST/GET)
client.transport.operation_timeout = operation_timeout or client.transport.operation_timeout or TIMEOUT
if session:
client.transport.session = session
self.__obj = client
self.__service = None
+1
View File
@@ -0,0 +1 @@
from zeep.ns import *
+1
View File
@@ -0,0 +1 @@
from . import utils
+1 -1
View File
@@ -1 +1 @@
from zeep.wsdl.utils import etree_to_string
from zeep.wsdl.utils import etree_to_string, get_or_create_header
+1 -1
View File
@@ -1 +1 @@
from zeep.wsse.username import UsernameToken
from zeep.wsse.username import *