api.http_methods
¶
Module Contents¶
-
class
api.http_methods.
HttpMethods
(session, url)[source]¶ Bases:
object
HTTP Methods for vManage API Interaction
Provides a consistent interaction with the vManage REST API. Contains error handling for common HTTP interaction issues.
-
request
(self, method, headers=None, payload=None, files=None, timeout=STANDARD_TIMEOUT)[source]¶ Performs HTTP REST API Call.
- Parameters
method (str) – DELETE, GET, POST, PUT
headers (dict) – Use standard vManage header provided in module or custom header for specific API interaction
payload (str) – A formatted string to be delivered to vManage via POST or PUT REST call
file (obj) – A file to be sent to vManage
- Returns
- A parsable dictionary containing the full
response from vManage for an interaction
- Return type
result (dict)
- Raises
JSONDecodeError – Payload format error.
ConnectionError – Connection error.
HTTPError – An HTTP error occurred.
URLRequired – A valid URL is required to make a request.
TooManyRedirects – Too many redirects.
Timeout – The request timed out.
RequestException – There was an ambiguous exception.
-