Created
March 21, 2019 02:29
-
-
Save ghelobytes/6af6931942e107cc6a3218a8637e7d56 to your computer and use it in GitHub Desktop.
Convert s3 url to http url
This file contains hidden or 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