summary refs log tree commit diff
path: root/contrib/cmdclient/http.py
diff options
context:
space:
mode:
authorcclauss <cclauss@me.com>2019-06-17 19:21:30 +0200
committerAmber Brown <hawkowl@atleastfornow.net>2019-06-18 03:21:30 +1000
commit82d9d524bdb8ce2f54855589e44ce3a20ba1af37 (patch)
tree30b270bb9366314fe5d9868547675c2bbad2f632 /contrib/cmdclient/http.py
parentMerge pull request #5477 from matrix-org/babolivier/third_party_rules_3pid (diff)
downloadsynapse-82d9d524bdb8ce2f54855589e44ce3a20ba1af37.tar.xz
Fix seven contrib files with Python syntax errors (#5446)
* Fix seven contrib files with Python syntax errors

Signed-off-by: cclauss <cclauss@me.com>
Diffstat (limited to 'contrib/cmdclient/http.py')
-rw-r--r--contrib/cmdclient/http.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/contrib/cmdclient/http.py b/contrib/cmdclient/http.py
index c833f3f318..1bd600e148 100644
--- a/contrib/cmdclient/http.py
+++ b/contrib/cmdclient/http.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import print_function
 from twisted.web.client import Agent, readBody
 from twisted.web.http_headers import Headers
 from twisted.internet import defer, reactor
@@ -141,15 +142,15 @@ class TwistedHttpClient(HttpClient):
         headers_dict["User-Agent"] = ["Synapse Cmd Client"]
 
         retries_left = 5
-        print "%s to %s with headers %s" % (method, url, headers_dict)
+        print("%s to %s with headers %s" % (method, url, headers_dict))
         if self.verbose and producer:
             if "password" in producer.data:
                 temp = producer.data["password"]
                 producer.data["password"] = "[REDACTED]"
-                print json.dumps(producer.data, indent=4)
+                print(json.dumps(producer.data, indent=4))
                 producer.data["password"] = temp
             else:
-                print json.dumps(producer.data, indent=4)
+                print(json.dumps(producer.data, indent=4))
 
         while True:
             try:
@@ -161,7 +162,7 @@ class TwistedHttpClient(HttpClient):
                 )
                 break
             except Exception as e:
-                print "uh oh: %s" % e
+                print("uh oh: %s" % e)
                 if retries_left:
                     yield self.sleep(2 ** (5 - retries_left))
                     retries_left -= 1
@@ -169,8 +170,8 @@ class TwistedHttpClient(HttpClient):
                     raise e
 
         if self.verbose:
-            print "Status %s %s" % (response.code, response.phrase)
-            print pformat(list(response.headers.getAllRawHeaders()))
+            print("Status %s %s" % (response.code, response.phrase))
+            print(pformat(list(response.headers.getAllRawHeaders())))
         defer.returnValue(response)
 
     def sleep(self, seconds):