Use urlparse to parse url.