se adiciona .pre-commit-config.yaml
FossilOrigin-Name: 91aee68f7d92c2bef8805260296abdfe14191500e9ae1dec3fecaf562779940b
This commit is contained in:
@@ -29,7 +29,7 @@ class SOAPService:
|
||||
|
||||
def builder_response(self, as_dict):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
def todict(self):
|
||||
return asdict(self)
|
||||
|
||||
@@ -68,7 +68,7 @@ class GetNumberingRange(SOAPService):
|
||||
|
||||
def get_service(self):
|
||||
return 'GetNumberingRange'
|
||||
|
||||
|
||||
def build_response(self, as_dict):
|
||||
return GetNumberingRangeResponse.fromdict(as_dict)
|
||||
|
||||
@@ -92,14 +92,14 @@ class SendBillAsync(SOAPService):
|
||||
class SendTestSetAsyncResponse:
|
||||
ZipKey: str
|
||||
ErrorMessageList: List[str]
|
||||
|
||||
|
||||
@classmethod
|
||||
def fromdict(cls, data):
|
||||
return cls(
|
||||
data['ZipKey'],
|
||||
data['ErrorMessageList'] or []
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class SendTestSetAsync(SOAPService):
|
||||
fileName: str
|
||||
@@ -135,14 +135,14 @@ class GetStatusResponse:
|
||||
StatusDescription: str
|
||||
StatusCode: int
|
||||
ErrorMessage: List[str]
|
||||
|
||||
|
||||
@classmethod
|
||||
def fromdict(cls, data):
|
||||
return cls(data['IsValid'],
|
||||
data['StatusDescription'],
|
||||
data['StatusCode'],
|
||||
data['ErrorMessage']['string'])
|
||||
|
||||
|
||||
@dataclass
|
||||
class GetStatus(SOAPService):
|
||||
trackId: bytes
|
||||
@@ -196,7 +196,7 @@ class Habilitacion:
|
||||
class GetStatusZip(GetStatusZip):
|
||||
def get_wsdl(self):
|
||||
return Habilitacion.WSDL
|
||||
|
||||
|
||||
|
||||
class DianGateway:
|
||||
|
||||
@@ -230,7 +230,7 @@ class DianClient(DianGateway):
|
||||
def _open(self, service):
|
||||
return zeep.Client(service.get_wsdl(), wsse=UsernameToken(self._username, self._password))
|
||||
|
||||
|
||||
|
||||
class DianSignatureClient(DianGateway):
|
||||
|
||||
def __init__(self, private_key_path, public_key_path, password=None):
|
||||
@@ -250,5 +250,3 @@ class DianSignatureClient(DianGateway):
|
||||
,
|
||||
)
|
||||
return client
|
||||
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class MemorySignature(object):
|
||||
self.digest_method = digest_method
|
||||
self.signature_method = signature_method
|
||||
self.expires_dt = expires_dt
|
||||
|
||||
|
||||
def apply(self, envelope, headers):
|
||||
key = _make_sign_key(self.key_data, self.cert_data, self.password)
|
||||
_sign_envelope_with_key(
|
||||
@@ -225,7 +225,7 @@ def get_timestamp(timestamp = None, delta=None):
|
||||
timestamp = timestamp or datetime.utcnow()
|
||||
if delta:
|
||||
timestamp += delta
|
||||
|
||||
|
||||
format_ = '%Y-%m-%dT%H:%M:%SZ'
|
||||
timestamp = timestamp.replace(tzinfo=pytz.utc, microsecond=0)
|
||||
return timestamp.strftime(format_)
|
||||
@@ -233,7 +233,7 @@ def get_timestamp(timestamp = None, delta=None):
|
||||
def _append_timestamp(security, expires_dt=None):
|
||||
if expires_dt is None:
|
||||
expires_dt = timedelta(seconds=6000)
|
||||
|
||||
|
||||
etimestamp = utils.WSU.Timestamp({'{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Id': utils.get_unique_id()})
|
||||
etimestamp.append(utils.WSU.Created(get_timestamp()))
|
||||
etimestamp.append(utils.WSU.Expires(get_timestamp(delta=expires_dt)))
|
||||
|
||||
Reference in New Issue
Block a user