Skip to content

Instantly share code, notes, and snippets.

@tekumara
Created September 14, 2023 12:27
Show Gist options
  • Save tekumara/e08ee053b5e5fa33677a93aebc1975b9 to your computer and use it in GitHub Desktop.
Save tekumara/e08ee053b5e5fa33677a93aebc1975b9 to your computer and use it in GitHub Desktop.
parse_s3_url
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