furl
The easiest way to parse and modify URLs in Python
...It also handles encoding automatically, including percent-encoding, Unicode domains, Unicode paths, and query strings. furl supports Python 3 and PyPy3 and is designed to be well tested and practical for everyday backend, scripting, and data-processing workflows. It is a good fit for developers who frequently need to clean, transform, generate, or normalize URLs in Python applications.