0

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?

HenryM
  • 5,557
  • 7
  • 49
  • 105
  • This might also be a permissions problem. Do you have the required permissions to call HeadObject on the key? – spg Feb 28 '17 at 19:29
  • @spg that's what I thought and I've asked the administrator who tells me I have the permissions – HenryM Feb 28 '17 at 19:46
  • S3 had a outage yesterday. Can you try again today? – helloV Mar 01 '17 at 21:59
  • I got the `key` wrong. When I read the documentation carefully I clearly had put in the wrong `key`. Sorry everyone. – HenryM Mar 02 '17 at 08:29

1 Answers1

0

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

HenryM
  • 5,557
  • 7
  • 49
  • 105