diff --git a/CHANGELOG.md b/CHANGELOG.md index 270c556..58288cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.19.1 (May 15th, 2024) + +BUG FIXES: +* Fixed twisted transport to pass correct encoding on the body. + ## 0.19.0 (February 14th, 2024) ENHANCEMENTS: diff --git a/ns1/__init__.py b/ns1/__init__.py index 887934f..cee39e8 100644 --- a/ns1/__init__.py +++ b/ns1/__init__.py @@ -5,7 +5,7 @@ # from .config import Config -version = "0.19.0" +version = "0.19.1" class NS1: diff --git a/ns1/rest/transport/twisted.py b/ns1/rest/transport/twisted.py index 8c1a7db..d4c8c78 100644 --- a/ns1/rest/transport/twisted.py +++ b/ns1/rest/transport/twisted.py @@ -14,8 +14,9 @@ from ns1.rest.errors import ResourceException from ns1.rest.transport.base import TransportBase - +IS_PY3 = False if sys.version_info[0] == 3: + IS_PY3 = True from io import StringIO from urllib.parse import urlencode else: @@ -230,7 +231,10 @@ def _request_func(self, method, headers, data, files): """ bProducer = None if data: - bProducer = StringProducer(data) + if IS_PY3: + bProducer = StringProducer(data.encode("utf-8")) + else: + bProducer = StringProducer(data) elif files: if len(files) > 1: raise Exception(