pythonamazon-web-servicesamazon-s3boto3amazon-machine-learning

Key to boto3.client.get_batch_prediction() OutputURI


I'm trying to download the Output file from boto3.client.get_batch_prediction(). I figure the key is the filename bit of OutputURI so I'm doing client:

    response = batch.get_batch_prediction()
    if response['Status'] == 'COMPLETED':
        key = response['OutputUri'][response['OutputUri'].find('Output_'):response['OutputUri'].find('.csv')+4]
        s3 = boto3.resource('s3')
        s3.meta.client.download_file(settings.AWS_S3_BUCKET_OUTPUT, key, '/tmp/hello.txt')

But this returns

An error occurred (404) when calling the HeadObject operation: Not Found

I take this to mean the file isn't there. That means I've got my key wrong so how do I find it?


Solution

  • I got the key wrong. Note to self: Read the Docs carefully.