boto/boto — pull request #2082 by toastdriven (2014-02-06 23:21:02+00:00)
Title: Altered ``get_bucket`` to use ``HEAD``.

In reaction to #2078 (& the mentioned blog post), this pull alters the behavior of ``S3Connection.get_bucket``. This switches from the old approach of trying to fetch keys in the bucket to utilizing ``HeadBucket``.

Some further notes. I back-ported the old method to ``GSConnection``, since it doesn't appear Google Storage supports ``HEAD`` on a bucket - https://developers.google.com/storage/docs/reference-methods. I'd love to be corrected on this, but for now, I copied over the old behavior. I don't have a GS account to test with, so I'm really hoping I didn't break it. :confused:

Beyond that, this is mostly backward-compatible (& less expensive). The only thing that hurts is that ``HEAD`` requests (rightfully) don't include a body, but that makes the creation of ``S3ResponseError`` worse because there are no details. I faked in the common cases, but if anyone was parsing this before, they're going to have to alter their code. I've documented how they should approach that.

Review please? @jamesls @danielgtaylor @garnaat @mfschwartz