s3_start_transfer/src/archivematica.py
def am_api_post_json(api_path, data):
    """
    POST json to the Archivematica API
    :param api_path: URL path to request (without hostname, e.g. /api/v2/location/)
    :param data: Dict of data to post
    :returns: dict of json data returned by request
    """
    am_url = os.environ["ARCHIVEMATICA_URL"]
    am_user = os.environ["ARCHIVEMATICA_USERNAME"]
    am_api_key = os.environ["ARCHIVEMATICA_API_KEY"]
    am_headers = {"Authorization": f"ApiKey {am_user}:{am_api_key}"}

    url = f"{am_url}{api_path}"
    print(f"URL: {url}; Data: {data}")
    response = requests.post(url, json=data, headers=am_headers)
    print(f"Response: {response}")
    response_json = response.json()
    print(f"Response JSON: {response_json}")
    return response_json

    POST json to the Archivematica API
    :param api_path: URL path to request (without hostname, e.g. /api/v2/location/)
    :param data: Dict of data to post
    :returns: dict of json data returned by request
    
POST json to the Archivematica API
POST json to the Archivematica API
def am_api_post_json(api_path, data):
    am_url = os.environ["ARCHIVEMATICA_URL"]
    am_user = os.environ["ARCHIVEMATICA_USERNAME"]
    am_api_key = os.environ["ARCHIVEMATICA_API_KEY"]
    am_headers = {"Authorization": f"ApiKey {am_user}:{am_api_key}"}
    url = f"{am_url}{api_path}"
    print(f"URL: {url}; Data: {data}")
    response = requests.post(url, json=data, headers=am_headers)
    print(f"Response: {response}")
    response_json = response.json()
    print(f"Response JSON: {response_json}")
    return response_json
def am_api_post_json ( api_path , data ) : am_url = os . environ [ "ARCHIVEMATICA_URL" ] am_user = os . environ [ "ARCHIVEMATICA_USERNAME" ] am_api_key = os . environ [ "ARCHIVEMATICA_API_KEY" ] am_headers = { "Authorization" : f"ApiKey {am_user}:{am_api_key}" } url = f"{am_url}{api_path}" print ( f"URL: {url}; Data: {data}" ) response = requests . post ( url , json = data , headers = am_headers ) print ( f"Response: {response}" ) response_json = response . json ( ) print ( f"Response JSON: {response_json}" ) return response_json
POST json to the Archivematica API
POST json to the Archivematica API
"""
    POST json to the Archivematica API
    :param api_path: URL path to request (without hostname, e.g. /api/v2/location/)
    :param data: Dict of data to post
    :returns: dict of json data returned by request
    """
dict of json data returned by request
dict of json data returned by request
api_path
URL path to request (without hostname, e.g. /api/v2/location/)
URL path to request ( without hostname e . g . / api / v2 / location / )
data
Dict of data to post
Dict of data to post