Bug #42336
openrgw: failed to set correct storage class when post object
0%
Description
#!/usr/bin/python
from boto3.session import Session
import boto3
import botocore
botocore.session.Session().set_debug_logger()
bucketname = 'test1'
objectname = 'prefix/keyv7'
access_key = "yly"
secret_key = "yly"
url = "http://127.0.0.1:7480"
session = Session(access_key, secret_key)
s3_client = session.client(
's3',
endpoint_url=url,
use_ssl = False,
)
#import ipdb; ipdb.set_trace() # BREAKPOINT
conditions = [
["starts-with", "$Content-Type", "image/"],
["starts-with", "$key", "prefix/"],
{'x-amz-storage-class': 'STANDARD_IA'},
# {"success_action_redirect": "http://www.baidu.com"},
["content-length-range", 0, 20000000],
]
form_data = s3_client.generate_presigned_post(
Conditions = conditions,
Bucket = bucketname,
Key=objectname
)
form_data["fields"]['key'] = objectname
form_data["fields"]['x-amz-storage-class'] = 'STANDARD_IA'
- form_data["fields"]['success_action_redirect'] = 'http://www.baidu.com'
files = {"file": open('/root/5M', 'rb')}
import requests
import logging
from requests_toolbelt.utils import dump
logging.basicConfig(level=logging.DEBUG)
response = requests.post(form_data["url"], data=form_data["fields"], files=files)
data = dump.dump_all(response)
print(data.decode('utf-8'))
failed to set correct object storage class
Updated by joke lee over 4 years ago
Updated by Abhishek Lekshmanan over 4 years ago
- Status changed from New to Fix Under Review
- Pull request ID set to 30956
Updated by J. Eric Ivancich over 4 years ago
- Status changed from Fix Under Review to 7
Updated by Patrick Donnelly over 4 years ago
- Status changed from 7 to Fix Under Review