Created
September 14, 2023 12:27
-
-
Save tekumara/e08ee053b5e5fa33677a93aebc1975b9 to your computer and use it in GitHub Desktop.
parse_s3_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
from urllib.parse import urlparse | |
def parse_s3_url(url: str) -> tuple[str, str]: | |
pr = urlparse(url) | |
bucket = pr.netloc | |
key = pr.path.lstrip("/") | |
return bucket, key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment