def do_ams_post(endpoint, path, body, access_token, rformat="<STR_LIT>", ds_min_version="<STR_LIT>"):
min_ds = dsversion_min<EOL>content_acceptformat = json_acceptformat<EOL>acceptformat = json_acceptformat<EOL>if rformat == "<STR_LIT>":<EOL><INDENT>min_ds = ds_min_version<EOL>content_acceptformat = json_only_acceptformat<EOL><DEDENT>if rformat == "<STR_LIT>":<EOL><INDENT>content_acceptformat = xml_acceptformat<EOL>acceptformat = xml_acceptformat + "<STR_LIT>"<EOL><DEDENT>headers = {"<STR_LIT:Content-Type>": content_acceptformat,<EOL>"<STR_LIT>": min_ds,<EOL>"<STR_LIT>": dsversion_max,<EOL>"<STR_LIT>": acceptformat,<EOL>"<STR_LIT>" : charset,<EOL>"<STR_LIT>": "<STR_LIT>" + access_token,<EOL>"<STR_LIT>" : xmsversion}<EOL>response = requests.post(endpoint, data=body, headers=headers, allow_redirects=False)<EOL>if response.status_code == <NUM_LIT>:<EOL><INDENT>redirected_url = '<STR_LIT>'.join([response.headers['<STR_LIT:location>'], path])<EOL>response = requests.post(redirected_url, data=body, headers=headers)<EOL><DEDENT>return response<EOL>
Do a AMS HTTP POST request and return JSON.
    Args:
        endpoint (str): Azure Media Services Initial Endpoint.
        path (str): Azure Media Services Endpoint Path.
        body  (str): Azure Media Services Content Body.
        access_token (str): A valid Azure authentication token.
        rformat (str): A required JSON Accept Format.
        ds_min_version (str): A required DS MIN Version.

    Returns:
        HTTP response. JSON body.