lib/rest_requests/request.py
def post_request(url, digest_login, element_description, asset_type_description=None, asset_description=None,
                 data=None, files=None):
    """
    Make a post request to the given url with the given digest login. If the request fails with an error or a status
    code != 200, a Request Error with the error message /status code and the given descriptions is thrown.

    :param url: URL to make post request to
    :type url: str
    :param digest_login: Login delete_artefacts for digest authentication
    :type digest_login: DigestLogin
    :param element_description: Element description in case of errors, e.g. 'event', 'series', 'tenants' (required)
    :type element_description: str
    :param asset_type_description: Asset type type description in case of errors, e.g. 'series', 'episode' (optional)
    :type asset_type_description: str
    :param asset_description: Asset description in case of errors, e.g. 'Dublin Core catalogs', 'ACL' (optional)
    :type asset_description: str
    :param data: Any delete_artefacts to attach to the request (optional)
    :type data: dict
    :param files: Any files to attach to the request (optional)
    :type files: dict
    :return: response
    :raise: RequestError
    """

    auth = HTTPDigestAuth(digest_login.user, digest_login.password)
    headers = {"X-Requested-Auth": "Digest"}

    try:
        response = requests.post(url, auth=auth, headers=headers, data=data, files=files)
    except Exception as e:
        raise RequestError.with_error(url, str(e), element_description, asset_type_description, asset_description)

    if response.status_code < 200 or response.status_code > 299:
        raise RequestError.with_statuscode(url, response.status_code, element_description, asset_type_description,
                                           asset_description)
    return response

    Make a post request to the given url with the given digest login. If the request fails with an error or a status
    code != 200, a Request Error with the error message /status code and the given descriptions is thrown.

    :param url: URL to make post request to
    :type url: str
    :param digest_login: Login delete_artefacts for digest authentication
    :type digest_login: DigestLogin
    :param element_description: Element description in case of errors, e.g. 'event', 'series', 'tenants' (required)
    :type element_description: str
    :param asset_type_description: Asset type type description in case of errors, e.g. 'series', 'episode' (optional)
    :type asset_type_description: str
    :param asset_description: Asset description in case of errors, e.g. 'Dublin Core catalogs', 'ACL' (optional)
    :type asset_description: str
    :param data: Any delete_artefacts to attach to the request (optional)
    :type data: dict
    :param files: Any files to attach to the request (optional)
    :type files: dict
    :return: response
    :raise: RequestError
    
Make a post request to the given url with the given digest login. If the request fails with an error or a status
code != 200, a Request Error with the error message /status code and the given descriptions is thrown.
Make a post request to the given url with the given digest login . If the request fails with an error or a status code ! = 200 a Request Error with the error message / status code and the given descriptions is thrown .
def post_request(url, digest_login, element_description, asset_type_description=None, asset_description=None,
                 data=None, files=None):
    auth = HTTPDigestAuth(digest_login.user, digest_login.password)
    headers = {"X-Requested-Auth": "Digest"}
    try:
        response = requests.post(url, auth=auth, headers=headers, data=data, files=files)
    except Exception as e:
        raise RequestError.with_error(url, str(e), element_description, asset_type_description, asset_description)
    if response.status_code < 200 or response.status_code > 299:
        raise RequestError.with_statuscode(url, response.status_code, element_description, asset_type_description,
                                           asset_description)
    return response
def post_request ( url , digest_login , element_description , asset_type_description = None , asset_description = None , data = None , files = None ) : auth = HTTPDigestAuth ( digest_login . user , digest_login . password ) headers = { "X-Requested-Auth" : "Digest" } try : response = requests . post ( url , auth = auth , headers = headers , data = data , files = files ) except Exception as e : raise RequestError . with_error ( url , str ( e ) , element_description , asset_type_description , asset_description ) if response . status_code < 200 or response . status_code > 299 : raise RequestError . with_statuscode ( url , response . status_code , element_description , asset_type_description , asset_description ) return response
Make a post request to the given url with the given digest login.
Make a post request to the given url with the given digest login .
"""
    Make a post request to the given url with the given digest login. If the request fails with an error or a status
    code != 200, a Request Error with the error message /status code and the given descriptions is thrown.

    :param url: URL to make post request to
    :type url: str
    :param digest_login: Login delete_artefacts for digest authentication
    :type digest_login: DigestLogin
    :param element_description: Element description in case of errors, e.g. 'event', 'series', 'tenants' (required)
    :type element_description: str
    :param asset_type_description: Asset type type description in case of errors, e.g. 'series', 'episode' (optional)
    :type asset_type_description: str
    :param asset_description: Asset description in case of errors, e.g. 'Dublin Core catalogs', 'ACL' (optional)
    :type asset_description: str
    :param data: Any delete_artefacts to attach to the request (optional)
    :type data: dict
    :param files: Any files to attach to the request (optional)
    :type files: dict
    :return: response
    :raise: RequestError
    """
None
None
url
URL to make post request to
URL to make post request to
digest_login
Login delete_artefacts for digest authentication
Login delete_artefacts for digest authentication
element_description
Element description in case of errors, e.g. 'event', 'series', 'tenants' (required)
Element description in case of errors e . g . ' event ' ' series ' ' tenants ' ( required )
asset_type_description
Asset type type description in case of errors, e.g. 'series', 'episode' (optional)
Asset type type description in case of errors e . g . ' series ' ' episode ' ( optional )
asset_description
Asset description in case of errors, e.g. 'Dublin Core catalogs', 'ACL' (optional)
Asset description in case of errors e . g . ' Dublin Core catalogs ' ' ACL ' ( optional )
data
Any delete_artefacts to attach to the request (optional)
Any delete_artefacts to attach to the request ( optional )
files
Any files to attach to the request (optional)
Any files to attach to the request ( optional )