This is my boto3 command for getting the object with a specific key from an S3 bucket:
resp = s3client.get_object(Bucket='<>-<>', Key='MzA1MjY1NzkzX2QudHh0')
It gives the following error:
botocore.errorfactory.NoSuchKey: An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist.
I have checked in the bucket, and the key actually exists
Did I miss something or did I do something wrong here?
You have a %0A at the end of your URL; that's a line separator.
Yeah. I tried with
MzA1MjY1NzkzX2QudHh0%0A
also. Didn't work :/Rename your object. That's a special character, probably giving you issues.
Your bucket has public list too; so I was able to navigate to s3.amazonaws.com/cypher-secondarybucket/MzA1MjY1NzkzX2QudHh0%0A and get "Access denied" as opposed to going to s3.amazonaws.com/cypher-secondarybucket/MzA1MjY1NzkzX2QudHh0 and getting "Key doesn't exist"
@Dawny33 adding
%0A
to the key will probably result in double-encoding to%250A
. Add a literal newline\n
to the key string. And then, like Chris said, rename the key. Special characters will cause grief.Rectified this :D