Support for authentication in HTTP plugin methods
This commit is contained in:
parent
12fefaa220
commit
c55deab6cb
1 changed files with 3 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue