Exemple #1
0
def delete(url, headers=None):
    """Delete the item with the given url.

    :param url: the server, port, and path
    (i.e. http://127.0.0.1:8000/api/v1/credentials/1)
    :returns: reponse object
    """
    ssl_verify = get_ssl_verify()
    return requests.delete(url, headers=headers, verify=ssl_verify)
Exemple #2
0
def delete(path, headers=None):
    """Delete the item with the given path with the configured server location.

    :param path: path after server and port (i.e. /api/v1/credentials/1)
    :returns: reponse object
    """
    url = get_server_location() + path
    ssl_verify = get_ssl_verify()
    return requests.delete(url, headers=headers, verify=ssl_verify)
Exemple #3
0
def get(url, params=None, headers=None):
    """Get JSON data from the given url.

    :param url: the server, port, and path
    (i.e. http://127.0.0.1:8000/api/v1/credentials)
    :param params: uri encoding params (i.e. ?param1=hello&param2=world)
    :returns: reponse object
    """
    ssl_verify = get_ssl_verify()
    return requests.get(url, params=params, headers=headers, verify=ssl_verify)
Exemple #4
0
def post(url, payload, headers=None):
    """Post JSON payload to the given url.

    :param url: the server, port, and path
    (i.e. http://127.0.0.1:8000/api/v1/scans/)
    :param payload: dictionary of payload to be posted
    :returns: reponse object
    """
    ssl_verify = get_ssl_verify()
    return requests.post(url, json=payload, headers=headers, verify=ssl_verify)
Exemple #5
0
def put(path, payload, headers=None):
    """Put JSON payload to the given path with the configured server location.

    :param path: path after server and port (i.e. /api/v1/credentials)
    :param payload: dictionary of payload to be posted
    :returns: reponse object
    """
    url = get_server_location() + path
    ssl_verify = get_ssl_verify()
    return requests.put(url, json=payload, headers=headers, verify=ssl_verify)
Exemple #6
0
def get(path, params=None, headers=None):
    """Get JSON data from the given path with the configured server location.

    :param path:  path after server and port (i.e. /api/v1/credentials)
    :param params: uri encoding params (i.e. ?param1=hello&param2=world)
    :returns: reponse object
    """
    url = get_server_location() + path
    ssl_verify = get_ssl_verify()
    return requests.get(url, params=params, headers=headers, verify=ssl_verify)