Skip to content

Commit

Permalink
feat(client)!: change encoder field type from class to instance
Browse files Browse the repository at this point in the history
  • Loading branch information
rostyq committed Feb 27, 2024
1 parent 9c75eee commit 1b19df0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions liqpy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ def __init__(
validator: Optional[BaseValidator] = None,
preprocessor: Optional[BasePreprocessor] = None,
encoder: Optional[JSONEncoder] = None,
decoder: Optional[Type[JSONDecoder]] = None,
decoder: Optional[JSONDecoder] = None,
):
self.update_keys(public_key=public_key, private_key=private_key)
self.session = session

self.validator = validator if validator is not None else Validator()
self.preprocessor = preprocessor if preprocessor is not None else Preprocessor()
self.encoder = encoder if encoder is not None else Encoder()
self.decoder = decoder if decoder is not None else Decoder
self.decoder = decoder if decoder is not None else Decoder()

@property
def public_key(self) -> str:
Expand Down Expand Up @@ -248,7 +248,7 @@ def request(self, /, action: "Action", **kwargs: "LiqpayRequestDict") -> dict:
if not response.headers.get("Content-Type", "").startswith("application/json"):
raise exception(response=response)

data: dict = response.json(cls=self.decoder)
data: dict = self.decoder.decode(response.text)

result: Optional[Literal["ok", "error"]] = data.pop("result", None)
status = data.get("status")
Expand Down

0 comments on commit 1b19df0

Please sign in to comment.