from urllib.parse import urlparse
o = urlparse('http://url.something.com/bla.html?querystring=stuff')
url_without_query_string = o.scheme + '://' + o.netloc + o.path
print(url_without_query_string)
How do I remove a query from a url?