I think using [urlparse.urljoin](https://docs.python.org/2.7/library/urlparse.html#urlparse.urljoin) is a more idiomatic approach. Haven't tested it though.