Last active
September 25, 2019 14:11
-
-
Save worldmind/00d8c37f8a4d466ccbb7be0d44a71db2 to your computer and use it in GitHub Desktop.
Python Url type
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 quote, urlencode, ParseResult as Url | |
Url.__str__ = Url.geturl | |
bucket_name = 'something_with space' | |
file_name = 'data.txt' | |
url = Url( | |
scheme='https', | |
netloc='s3.console.aws.amazon.com', | |
path=quote(f"/s3/buckets/{bucket_name}/{file_name}"), | |
params='', | |
query=urlencode({'region': 'Беларусь'}), | |
fragment='', | |
) | |
print(url) |
Author
worldmind
commented
Sep 23, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment