Normalize URL path python

I had a problem with some URLs that we found on someones website. They looked like this: <a href=”http://example.com/../../../path/page.html”>, here is the same link: test. Notice that when you mouse over it, Firefox normalizes the URL so it looks correct. Using urlparse in Python: print urlparse.urljoin( ‘http://site.com/’, ‘/path/../path/.././path/./’ ) ‘http://site.com/path/../path/.././path/./’ How, poopy. So, we need to do better than that. The os module […]

Continue Reading