From 0dd1dff5c65041d1fcdfbe9c079fea5fe966517c Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Wed, 9 Oct 2013 11:12:32 +0200 Subject: [PATCH] Pass keywords to the request initialization The `prepare_request` function accepts keywords corresponding to what the Request class can take as arguments. This patch passes those kwargs to the newly created `Request` instance, which is needed for the correct work of the auth backend. Partially-Implements blueprint python-marconiclient-v1 Change-Id: Ib333a7ad4d4628e2e5a66ddc91fafc378679f69c --- marconiclient/transport/request.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/marconiclient/transport/request.py b/marconiclient/transport/request.py index 6f3b875f..8aa4c3b4 100644 --- a/marconiclient/transport/request.py +++ b/marconiclient/transport/request.py @@ -21,9 +21,7 @@ from marconiclient import auth from marconiclient import errors -def prepare_request(conf, endpoint=None, - params=None, headers=None, - data=None): +def prepare_request(conf, data=None, **kwargs): """Prepares a request This method takes care of authentication @@ -37,12 +35,13 @@ def prepare_request(conf, endpoint=None, :param data: Optional data to send along with the request. If data is not None, it'll be serialized. :type data: Any primitive type that is json-serializable. + :param kwargs: Anything accepted by `Request` :returns: A `Request` instance ready to be sent. :rtype: `Request` """ - req = Request() + req = Request(**kwargs) auth_backend = auth.get_backend(conf) # TODO(flaper87): Do something smarter # to get the api_version.