From c4b73cb36bb187190fc33acb8a4c73cbf33d0700 Mon Sep 17 00:00:00 2001 From: Odd Gunnar Aspaas Date: Thu, 21 Mar 2024 15:51:03 +0100 Subject: [PATCH] Fix json encoding error --- CHANGELOG.md | 6 ++++++ src/pyclarify/__init__.py | 2 +- src/pyclarify/client.py | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9891f73..8e54a82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ Changes are grouped as follows - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. +## [0.6.3] - 2024-03-12 + +### Fixed + +- Fixed json decoding bug in in Pydantic where special characters where not serialized correctly. More specifically two byte characters would be read as 1 byte, resulting in incorrect content length. + ## [0.6.2] - 2024-03-12 ### Fixed diff --git a/src/pyclarify/__init__.py b/src/pyclarify/__init__.py index 43fc70f..2ccb4fc 100644 --- a/src/pyclarify/__init__.py +++ b/src/pyclarify/__init__.py @@ -25,5 +25,5 @@ ) import pyclarify.query -__version__ = "0.6.2" +__version__ = "0.6.3" __API_version__ = "1.1" diff --git a/src/pyclarify/client.py b/src/pyclarify/client.py index 20045ae..9d78370 100644 --- a/src/pyclarify/client.py +++ b/src/pyclarify/client.py @@ -23,6 +23,7 @@ import logging import pyclarify import requests +import json from pyclarify.__utils__.stopping_conditions import select_stopping_condition from datetime import timedelta, datetime from pydantic import validate_arguments @@ -109,7 +110,7 @@ def iterate_requests( counter = 0 for request in iterator: counter += 1 - r = request.model_dump_json() + r = json.dumps(request.model_dump(mode='json')) # TODO: Pydantic V2 does not do this in an elegant way rpc_response = self.make_request(r) response = self.handle_response(request, rpc_response) if responses is None: