Exemplo n.º 1
0
def auth_delete(
    url: str,
    json: Any = {},
    params: Dict[str, str] = {},
    headers: Dict[str, str] = {},
    token: Optional[str] = None,
) -> requests.models.Response:
    """Perform a requests.delete with Authorization and default headers set"""
    headers = {
        **get_default_headers(),
        **headers,
        **get_auth_header(token or get_default_token()),
    }
    r = requests.delete(url, headers=headers, params=params, json=json)
    return r
Exemplo n.º 2
0
def auth_get(
    url: str,
    params: Dict[str, str] = {},
    headers: Dict[str, str] = {},
    token: Optional[str] = None,
    timeout: Optional[float] = DEFAULT_TIMEOUT,
) -> requests.models.Response:
    """Perform a requests.get with Authorization and default headers set"""
    headers = {
        **get_default_headers(),
        **headers,
        **get_auth_header(token or get_default_token()),
    }
    r = requests.get(url, headers=headers, params=params, timeout=timeout)
    return r