From b2d570e991a01ba4ad15f623998c5acfed4993a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Bocahu?= Date: Mon, 30 Mar 2015 10:23:46 +0200 Subject: [PATCH] Removes YAML body_format option It would require adding a dependency to the YAML module while it might not provide much benefit (has anybody seen a HTTP API taking YAML as input ?) --- network/basics/uri.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/network/basics/uri.py b/network/basics/uri.py index e3449ccbd3e..24f0dbf9e1f 100644 --- a/network/basics/uri.py +++ b/network/basics/uri.py @@ -66,7 +66,7 @@ options: default: null body_format: description: - - The serialization format of the body. Either raw, json, or yaml. When set to json or yaml, encodes the body argument and automatically sets the Content-Type header accordingly. + - The serialization format of the body. Either raw, or json. When set to json, encodes the body argument and automatically sets the Content-Type header accordingly. required: false default: raw method: @@ -340,7 +340,7 @@ def main(): user = dict(required=False, default=None), password = dict(required=False, default=None), body = dict(required=False, default=None), - body_format = dict(required=False, default='raw', choices=['raw', 'json', 'yaml']), + body_format = dict(required=False, default='raw', choices=['raw', 'json']), method = dict(required=False, default='GET', choices=['GET', 'POST', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'PATCH']), return_content = dict(required=False, default='no', type='bool'), force_basic_auth = dict(required=False, default='no', type='bool'), @@ -376,13 +376,10 @@ def main(): dict_headers = {} - # If body_format is json or yaml, encore the body (wich can be a dict or a list) and automatically sets the Content-Type header + # If body_format is json, encodes the body (wich can be a dict or a list) and automatically sets the Content-Type header if body_format == 'json': body = json.dumps(body) dict_headers['Content-Type'] = 'application/json' - elif body_format == 'yaml': - body = yaml.dump(body) - dict_headers['Content-Type'] = 'application/yaml' # Grab all the http headers. Need this hack since passing multi-values is currently a bit ugly. (e.g. headers='{"Content-Type":"application/json"}')