Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

bucket.list() raises 403 when list too long #3006

Open
lajarre opened this issue Mar 5, 2015 · 2 comments
Open

bucket.list() raises 403 when list too long #3006

lajarre opened this issue Mar 5, 2015 · 2 comments

Comments

@lajarre
Copy link

lajarre commented Mar 5, 2015

This seems really related to the number of keys since I'm able to go around the problem by cutting in chunks.

Heres' the err:

---------------------------------------------------------------------------
S3ResponseError                           Traceback (most recent call last)
<ipython-input-49-cb354284039c> in <module>()
----> 1 for k in bu.list(prefix='media/documents/'):
      2     print k
      3

./lib/python2.7/site-packages/boto/s3/bucketlistresultset.pyc in bucket_lister(bucket, prefix, delimiter, marker, headers, encoding_type)
     32         rs = bucket.get_all_keys(prefix=prefix, marker=marker,
     33                                  delimiter=delimiter, headers=headers,
---> 34                                  encoding_type=encoding_type)
     35         for k in rs:
     36             yield k

./lib/python2.7/site-packages/boto/s3/bucket.pyc in get_all_keys(self, headers, **params)
    470         return self._get_all([('Contents', self.key_class),
    471                               ('CommonPrefixes', Prefix)],
--> 472                              '', headers, **params)
    473
    474     def get_all_versions(self, headers=None, **params):

./lib/python2.7/site-packages/boto/s3/bucket.pyc in _get_all(self, element_map, initial_query_string, headers, **params)
    408         else:
    409             raise self.connection.provider.storage_response_error(
--> 410                 response.status, response.reason, body)
    411
    412     def validate_kwarg_names(self, kwargs, names):

S3ResponseError: S3ResponseError: 403 Forbidden
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId....

@bcipolli
Copy link

@lajarre how did you cut things into chunks? I'm afraid I may be hitting the same issue.

@lajarre
Copy link
Author

lajarre commented Jun 15, 2015

@bcipolli Don't remember precisely but I guess I did something using the marker arg like:

k = None
while True:
    try:
        for k in bucket.list(marker=k):
            print k
    except S3ResponseError:
        pass
    else:
        break

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants