[issue38408] urlparse gives no method to build a url with a port

2019-10-09 Thread Guido van Rossum
Guido van Rossum added the comment: @Amir maybe you can update the docs to add an example of how to do this (if there isn't already one there). -- ___ Python tracker ___

[issue38408] urlparse gives no method to build a url with a port

2019-10-09 Thread Eric V. Smith
Eric V. Smith added the comment: Okay, then I'll close this. -- resolution: -> wont fix stage: -> resolved status: open -> closed type: -> behavior ___ Python tracker ___ _

[issue38408] urlparse gives no method to build a url with a port

2019-10-09 Thread Guido van Rossum
Guido van Rossum added the comment: Then I find insufficient reason to change the API. Users who need this frequently can make their own wrapper. -- --Guido (mobile) -- ___ Python tracker __

[issue38408] urlparse gives no method to build a url with a port

2019-10-09 Thread Eric V. Smith
Eric V. Smith added the comment: Yes, that does work: >>> urllib.parse.urlunparse(("http", f"{host}:{port}", "/", "", "", "")) 'http://hostname:1234/' The only problem is that your code now needs to look like >>> port=None >>> urllib.parse.urlunparse(("http", f"{host}{(':' + str(port)) if

[issue38408] urlparse gives no method to build a url with a port

2019-10-09 Thread Guido van Rossum
Guido van Rossum added the comment: Does it work if you pass a string of the form "host:port" as the host field? I'd rather not change this antiquated interface too much, and I don't like proliferating additional functions. -- nosy: +gvanrossum __

[issue38408] urlparse gives no method to build a url with a port

2019-10-08 Thread Eric V. Smith
Eric V. Smith added the comment: One way I can think of doing this in a backward compatible way is to add keyword parameters to urlunparse, like: def urlunparse(components, *, username=None, password=None, hostname=None, port=None): Which would make your call: site_to_test = urllib.parse.ur

[issue38408] urlparse gives no method to build a url with a port

2019-10-08 Thread Amir Mohamadi
Amir Mohamadi added the comment: Hi! I'm a newbie but I'd like to work on this issue can I work on it??? -- nosy: +Amir ___ Python tracker ___

[issue38408] urlparse gives no method to build a url with a port

2019-10-08 Thread James Allsopp
New submission from James Allsopp : 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