diff options
author | David Baker <dbkr@matrix.org> | 2014-11-21 12:21:00 +0000 |
---|---|---|
committer | David Baker <dbkr@matrix.org> | 2014-11-21 12:21:00 +0000 |
commit | eb6aedf92c0fe467fd4724623262907ad78573bb (patch) | |
tree | 69b1f04952ffd7dd82b6643a56f1bc4e34c2087b /synapse/http/client.py | |
parent | Merge branch 'develop' into pushers (diff) | |
download | synapse-eb6aedf92c0fe467fd4724623262907ad78573bb.tar.xz |
More work on pushers. Attempt to do HTTP pokes. Not sure if the actual HTTP pokes work or not yet but the retry semantics are pretty good.
Diffstat (limited to 'synapse/http/client.py')
-rw-r--r-- | synapse/http/client.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py index 048a428905..82e80385ce 100644 --- a/synapse/http/client.py +++ b/synapse/http/client.py @@ -61,6 +61,25 @@ class SimpleHttpClient(object): defer.returnValue(json.loads(body)) @defer.inlineCallbacks + def post_json_get_json(self, uri, post_json): + json_str = json.dumps(post_json) + + logger.info("HTTP POST %s -> %s", json_str, uri) + + response = yield self.agent.request( + "POST", + uri.encode("ascii"), + headers=Headers({ + "Content-Type": ["application/json"] + }), + bodyProducer=FileBodyProducer(StringIO(json_str)) + ) + + body = yield readBody(response) + + defer.returnValue(json.loads(body)) + + @defer.inlineCallbacks def get_json(self, uri, args={}): """ Get's some json from the given host and path |