From 2a123b697b5d34875d27c97fad35f6b8f1b09416 Mon Sep 17 00:00:00 2001 From: timerke Date: Wed, 28 Aug 2024 18:51:57 +0300 Subject: [PATCH] forward all requests params to request method --- redminelib/engines/base.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/redminelib/engines/base.py b/redminelib/engines/base.py index ef04efc..a1ae88e 100644 --- a/redminelib/engines/base.py +++ b/redminelib/engines/base.py @@ -50,8 +50,7 @@ def create_session(**params): """ raise NotImplementedError - @staticmethod - def construct_request_kwargs(method, headers, params, data): + def construct_request_kwargs(self, method, headers, params, data): """ Constructs kwargs that will be used in all requests to Redmine. @@ -61,12 +60,12 @@ def construct_request_kwargs(method, headers, params, data): :param data: (required). Data to send in the body of the request. :type data: dict, bytes or file-like object """ - kwargs = {'data': data or {}, 'params': params or {}, 'headers': headers or {}} + + kwargs = dict(self.requests, **{'data': data or {}, 'params': params or {}, 'headers': headers or {}}) if method in ('post', 'put', 'patch') and 'Content-Type' not in kwargs['headers']: kwargs['data'] = json.dumps(data) kwargs['headers']['Content-Type'] = 'application/json' - return kwargs def request(self, method, url, headers=None, params=None, data=None):