The sushy.connector Module¶
-
class
sushy.connector.Connector(url, username=None, password=None, verify=True, response_callback=None)¶ Bases:
object-
close()¶ Close this connector and the associated HTTP session.
-
delete(path='', data=None, headers=None, blocking=False, timeout=60, **extra_session_req_kwargs)¶ HTTP DELETE method.
- Parameters
path – Optional sub-URI path to the resource.
data – Optional JSON data.
headers – Optional dictionary of headers.
blocking – Whether to block for asynchronous operations.
timeout – Max time in seconds to wait for blocking async call.
extra_session_req_kwargs – Optional keyword argument to pass requests library arguments which would pass on to requests session object.
- Returns
The response object from the requests library.
- Raises
ConnectionError
- Raises
HTTPError
-
get(path='', data=None, headers=None, blocking=False, timeout=60, **extra_session_req_kwargs)¶ HTTP GET method.
- Parameters
path – Optional sub-URI path to the resource.
data – Optional JSON data.
headers – Optional dictionary of headers.
blocking – Whether to block for asynchronous operations.
timeout – Max time in seconds to wait for blocking async call.
extra_session_req_kwargs – Optional keyword argument to pass requests library arguments which would pass on to requests session object.
- Returns
The response object from the requests library.
- Raises
ConnectionError
- Raises
HTTPError
-
patch(path='', data=None, headers=None, blocking=False, timeout=60, **extra_session_req_kwargs)¶ HTTP PATCH method.
- Parameters
path – Optional sub-URI path to the resource.
data – Optional JSON data.
headers – Optional dictionary of headers.
blocking – Whether to block for asynchronous operations.
timeout – Max time in seconds to wait for blocking async call.
extra_session_req_kwargs – Optional keyword argument to pass requests library arguments which would pass on to requests session object.
- Returns
The response object from the requests library.
- Raises
ConnectionError
- Raises
HTTPError
-
post(path='', data=None, headers=None, blocking=False, timeout=60, **extra_session_req_kwargs)¶ HTTP POST method.
- Parameters
path – Optional sub-URI path to the resource.
data – Optional JSON data.
headers – Optional dictionary of headers.
blocking – Whether to block for asynchronous operations.
timeout – Max time in seconds to wait for blocking async call.
extra_session_req_kwargs – Optional keyword argument to pass requests library arguments which would pass on to requests session object.
- Returns
The response object from the requests library.
- Raises
ConnectionError
- Raises
HTTPError
-
put(path='', data=None, headers=None, blocking=False, timeout=60, **extra_session_req_kwargs)¶ HTTP PUT method.
- Parameters
path – Optional sub-URI path to the resource.
data – Optional JSON data.
headers – Optional dictionary of headers.
blocking – Whether to block for asynchronous operations.
timeout – Max time in seconds to wait for blocking async call.
extra_session_req_kwargs – Optional keyword argument to pass requests library arguments which would pass on to requests session object.
- Returns
The response object from the requests library.
- Raises
ConnectionError
- Raises
HTTPError
-
set_auth(auth)¶ Sets the authentication mechanism for our connector.
-
set_http_basic_auth(username, password)¶ Sets the http basic authentication information.
-
set_http_session_auth(session_auth_token)¶ Sets the session authentication information.
-