Relative URL Parser Snippetby dave on 2009-01-05
Python 3.0 seems to come with fancy new features to urllib including urllib.parse which is an excellent utility for parsing the different components of URLs. I however don't use python 3.0 yet and needed a clean way to make full URLs given a base URL and relative URLs.
This is helpful if you're scraping a webpage and need the full paths of any links. Its not clean but here's the snippet:
And here's how you can use it. Hope it helps, feel free to use.