Is bucket.set_tags() correct? The tagging should be set on object, instead of bucket.
opened this issue · comments
I want to set tags for some object, but I can't find any docs about this. All docs I found are as below: The code that are used to set tagging for bucket.
t = Tags()
tag_set = TagSet()
tag_set.add_tag('tagkey', 'tagvalue')
t.add_tag_set(tag_set)
bucket.set_tags(t)
And I catch the network package for the code. As I expected, it's wrong. The correct request header shout be PUT /ObjectName?tagging HTTP/1.1
.
PUT /bucket1/?tagging HTTP/1.1
Host: localhost:8000
Accept-Encoding: identity
User-Agent: Boto/2.48.0 Python/3.5.2 Linux/4.10.0-40-generic
Content-Length: 85
Content-Type: text/xml
Authorization: AWS 0555b35654ad1656d804:hwpkEA7++lsU+6WIjzL6NLlAjP4=
Content-MD5: y6IbdFMGYy05aYZL4S0WTg==
Date: Tue, 05 Dec 2017 06:49:49 GMT
<Tagging><TagSet><Tag><Key>tagkey</Key><Value>tagval</Value></Tag></TagSet></Tagging>
HTTP/1.1 400 Bad Request
Content-Length: 220
x-amz-request-id: tx00000000000000000002a-005a26418d-1042-default
Accept-Ranges: bytes
Content-Type: application/xml
Date: Tue, 05 Dec 2017 06:49:49 GMT
<?xml version="1.0" encoding="UTF-8"?><Error><Code>InvalidArgument</Code><BucketName>bucket1</BucketName><RequestId>tx00000000000000000002a-005a26418d-1042-default</RequestId><HostId>1042-default-default</HostId></Error>
So how do I set tagging for some object by boto?