Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix-twisted-transport-support #125

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading