-
-
Save revolutionisme/05ca22912f32075afec61e2c8d2eb605 to your computer and use it in GitHub Desktop.
Convert s3 url to http url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def s3_to_http(url): | |
if url.startswith('s3://'): | |
s3_path = url | |
bucket = s3_path[5:].split('/')[0] | |
object_name = '/'.join(s3_path[5:].split('/')[1:]) | |
return 'https://s3.amazonaws.com/{0}/{1}'.format(bucket, object_name) | |
else: | |
return url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment