Fixed using urlparse.urljoin.