[New-bugs-announce] [issue38408] urlparse gives no method to build a url with a port

James Allsopp report at bugs.python.org
Tue Oct 8 05:51:03 EDT 2019


New submission from James Allsopp <jamesaallsopp at googlemail.com>:

Hi,
I like to build my Url's using url unparse, e.g.
site_to_test = urllib.parse.urlunparse((scheme, host, page, '', '', ''))
r = requests.get(site_to_test)

However, we reach a lot of sites through SSH tunnels, as our network is heavily locked down, and need to specify a port. Unfortunately, we can parse a url with a port, and get site_to_test.port = '9097' we can't run it the other way, e.g. this fails.
site_to_test = urllib.parse.urlunparse((scheme, host, page, '', '', '',port=9097))

This should be easy to fix and there's a use case for it.
Thanks

----------
components: Library (Lib)
messages: 354180
nosy: James Allsopp
priority: normal
severity: normal
status: open
title: urlparse gives no method to build a url with a port
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38408>
_______________________________________


More information about the New-bugs-announce mailing list