-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3 Bucket no Encoding Type #816
Comments
Encoding type is automatically set because there are unicode characters which can break the XML parser. To work around the issue, we automatically set the encoding type parameter to What's your reasoning for wanting to omit the parameter? |
Is there a way to force the parameter to false or to avoid the XML parser and deal with raw output? None of the data that I am using has unicode characters, so I would like to force execution without url-encoding. Additionally, I don't know if s3 does any additional internal work depending on url-encoding specification, but it would be nice to be able to check that out. |
Any update? |
You can unregister the handler on the client like so: import boto3
from boto3.session import Session
from botocore.handlers import set_list_objects_encoding_type_url
s3 = boto3.client('s3')
s3.meta.events.unregister(
'before-parameter-build.s3.ListObjects',
set_list_objects_encoding_type_url)
# Unregister from a session
sess = Session()
sess.events.unregister(
'before-parameter-build.s3.ListObjects',
set_list_objects_encoding_type_url) |
Thank you for your response. I will give that a try. |
The reason is because Google Cloud storage gives this:
|
Put together a gist, hope it helps. I understand that boto3 belongs to aws and interoperability is an interim configuration but it required knowing more about s3 protocol than I wanted. https://gist.github.com/gleicon/2b8acb9f9c0f22753eaac227ff997b34 |
Following boto/botocore#726, list_objects will automatically include a encoding-type=url query param. However, the client does not decode all of the response elements properly -- notably, Prefix would remain encoded. Hopefully this will be fixed soon-ish (I've got a patch proposed at boto/botocore#1901) but in the meantime, use the work-around suggested in boto/boto3#816 of unregistering the set_list_objects_encoding_type_url handler. Signed-off-by: Tim Burke <tim.burke@gmail.com>
Following boto/botocore#726, list_objects will automatically include a encoding-type=url query param. However, the client does not decode all of the response elements properly -- notably, Prefix would remain encoded. Hopefully this will be fixed soon-ish (I've got a patch proposed at boto/botocore#1901) but in the meantime, use the work-around suggested in boto/boto3#816 of unregistering the set_list_objects_encoding_type_url handler. Signed-off-by: Tim Burke <tim.burke@gmail.com>
Is it possible to make a request with no encoding type? I am performing:
s3 = boto3.resource("s3")
bucket = s3.Bucket("myBucket")
objs = bucket.objects.filter(EncodingType=None, Prefix="foo")
This is still performing a GET request with ?encoding-type=url. Interestingly, the keys returned are only being formatted in URL encoding if the encoding type is specified accordingly, but the request is sending the parameter to url-encode the results every time.
http://boto3.readthedocs.io/en/latest/reference/services/s3.html?highlight=encodingType#S3.Bucket.objects
The text was updated successfully, but these errors were encountered: