Browse Source

Send bytes and not unicode when replicating

Brendan Abolivier 4 years ago
parent
commit
64e409443b
1 changed files with 4 additions and 3 deletions
  1. 4 3
      sydent/http/httpsclient.py

+ 4 - 3
sydent/http/httpsclient.py

@@ -17,8 +17,7 @@ from __future__ import absolute_import
 
 import logging
 import json
-
-from six import StringIO
+from io import BytesIO
 
 from zope.interface import implementer
 
@@ -66,8 +65,10 @@ class ReplicationHttpsClient:
             return
 
         headers = Headers({'Content-Type': ['application/json'], 'User-Agent': ['Sydent']})
+
+        json_bytes = json.dumps(jsonObject).encode("utf8")
         reqDeferred = self.agent.request(b'POST', uri.encode('utf8'), headers,
-                                         FileBodyProducer(StringIO(json.dumps(jsonObject))))
+                                         FileBodyProducer(BytesIO(json_bytes)))
 
         return reqDeferred