Skip to content

Commit

Permalink
Fix-twisted-transport-support
Browse files Browse the repository at this point in the history
Signed-off-by: dmavrommatis <dmavrommatis@ns1.com>
  • Loading branch information
dmavrommatis committed May 15, 2024
1 parent 23302bd commit 2e3693f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion ns1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
from .config import Config

version = "0.19.0"
version = "0.19.1"


class NS1:
Expand Down
8 changes: 6 additions & 2 deletions ns1/rest/transport/twisted.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 2e3693f

Please sign in to comment.