proknow.Requestor
– Requestor¶
-
class
proknow.Requestor.
Requestor
(base_url, username, password)¶ A class used for issuing requests for the ProKnow API
-
__init__
(base_url, username, password)¶ Initializes the Requestor class.
Parameters: - base_url (str) – The base URL to use when making request to the ProKnow API.
- username (str) – The string used in Basic Authentication as the user name.
- password (str) – The string used in Basic Authentication as the user password.
-
delete
(route, query=None, body=None)¶ Issues an HTTP
DELETE
request.Parameters: - route (str) – The API route to use in the request.
- query (dict, optional) – An optional dictionary of query parameters to use in the request.
- body (dict, optional) – An optional dictionary to be used as a JSON request body for the request.
Returns: A tuple (status_code, msg).
- status_code (int): the response code
- msg (str, dict): the text response or, if the response was JSON, the decoded JSON dictionary.
Return type: tuple
-
get
(route, query=None)¶ Issues an HTTP
GET
request.Parameters: - route (str) – The API route to use in the request.
- query (dict, optional) – An optional dictionary of query parameters to use in the request.
Returns: A tuple (status_code, msg).
- status_code (int): the response code
- msg (str, dict): the text response or, if the response was JSON, the decoded JSON dictionary.
Return type: tuple
-
patch
(route, query=None, body=None)¶ Issues an HTTP
PATCH
request.Parameters: - route (str) – The API route to use in the request.
- query (dict, optional) – An optional dictionary of query parameters to use in the request.
- body (dict, optional) – An optional dictionary to be used as a JSON request body for the request.
Returns: A tuple (status_code, msg).
- status_code (int): the response code
- msg (str, dict): the text response or, if the response was JSON, the decoded JSON dictionary.
Return type: tuple
-
post
(route, query=None, body=None)¶ Issues an HTTP
POST
request.Parameters: - route (str) – The API route to use in the request.
- query (dict, optional) – An optional dictionary of query parameters to use in the request.
- body (dict, optional) – An optional dictionary to be used as a JSON request body for the request.
Returns: A tuple (status_code, msg).
- status_code (int): the response code
- msg (str, dict): the text response or, if the response was JSON, the decoded JSON dictionary.
Return type: tuple
-
put
(route, query=None, body=None)¶ Issues an HTTP
PUT
request.Parameters: - route (str) – The API route to use in the request.
- query (dict, optional) – An optional dictionary of query parameters to use in the request.
- body (dict, optional) – An optional dictionary to be used as a JSON request body for the request.
Returns: A tuple (status_code, msg).
- status_code (int): the response code
- msg (str, dict): the text response or, if the response was JSON, the decoded JSON dictionary.
Return type: tuple
-