Fix Python – How to get everything after last slash in a URL?

How can I extract whatever follows the last slash in a URL in Python? For example, these URLs should return the following:
returns: TEST1

returns: TEST2

returns: 12345

I’ve tried urlparse, but that gives me the full path filename, such as….

Fix Python – How to join components of a path when you are constructing a URL in Python

For example, I want to join a prefix path to resource paths like /js/foo.js.
I want the resulting path to be relative to the root of the server. In the above example if the prefix was “media” I would want the result to be /media/js/foo.js.
os.path.join does this really well, but how it joins paths is OS dependent. In this case I know I am target….

Fix Python – Add params to given URL in Python

Suppose I was given a URL.
It might already have GET parameters (e.g. or it might not (e.g.
And now I need to add some parameters to it like {‘lang’:’en’,’tag’:’python’}. In the first case I’m going to have and in the second — http:/….