Update/add username in url in python

3003 views python
0

If I have a URL (ex: "ssh://hello@xyz.com:553/random_uri", "https://test.blah.blah:993/random_uri2"), I want to set/update the username in the url. I know there is urllib.parse.urlparse (https://docs.python.org/3/library/urllib.parse.html) that would break them down but I am having trouble creating a new url (or updating) the parsed result with the username I intend to use.

Is there any python library that can help set/update username? Preferably using the parsed result of an urlparse.

answered question

1 Answer

2

Found a way to do this: https://sdqali.in/blog/2017/09/25/python-url-manipulation-revisited/ Can create a 'furl' object, set username, and get updated url string.

posted this

Have an answer?

JD

Please login first before posting an answer.