On use of success_action_redirect on generate_presigned_post always return 403 #3739
Unanswered
BhuwanPandey
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Could you please clarify in your post what you're trying to achieve? Without context, we can't help. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
My code look like
s3_client = boto3.client('s3')
redirect_url = "http://127.0.0.1:8000/redirect/"
s3_presigned_url = s3_client.generate_presigned_post(
bucket_name,
folder,
Fields={"acl":"public-read" ,"Content-Type": "audio/mpeg","success_action_redirect": redirect_url},
Conditions = [{"acl":"public-read"},{"Content-Type": "audio/mpeg"},{"success_action_redirect": redirect_url}]
==================Here is the script ================
import requests
url = "http://127.0.0.1:8000/calling/"
headers = {
'Authorization': 'Token 930u0309u03018cd25852ef'
}
response = requests.request("POST", url, headers=headers)
#Upload file to S3 using presigned URL
OBJECT_NAME_TO_UPLOAD ="./image.jpg"
url = response.json()['details']['url']
fields = response.json()['details']['fields']
files = { 'file': open(OBJECT_NAME_TO_UPLOAD, 'rb')}
r = requests.post(url, data=fields, files=files)
print(r.status_code)
Beta Was this translation helpful? Give feedback.
All reactions