From c55deab6cbf123f5aee627cc02e631f7ca22bacf Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 11 Apr 2019 16:21:39 +0200 Subject: [PATCH] Support for authentication in HTTP plugin methods --- platypush/plugins/http/request/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platypush/plugins/http/request/__init__.py b/platypush/plugins/http/request/__init__.py index b9bc0f59..eb8addc6 100644 --- a/platypush/plugins/http/request/__init__.py +++ b/platypush/plugins/http/request/__init__.py @@ -46,6 +46,9 @@ class HttpRequestPlugin(Plugin): def _exec(self, method, url, output='text', **kwargs): """ Available output types: text (default), json, binary """ + if 'username' in kwargs and 'password' in kwargs: + kwargs['auth'] = (kwargs.pop('username'), kwargs.pop('password')) + method = getattr(requests, method) response = method(url, **kwargs) response.raise_for_status()