This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: urllib.request.FancyURLopener won't connect to pages requiring username and password
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: joneskoo, orsenthil, petr6.6
Priority: normal Keywords:

Created on 2010-08-31 17:05 by petr6.6, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg115269 - (view) Author: Petr Machek (petr6.6) Date: 2010-08-31 17:05
Code:

import urllib.request

class MyOpener(urllib.request.FancyURLopener):
    prompt_user_passwd = lambda x, y, z: ("username", "password")

opener = MyOpener()
page = opener.open("http://riddle.p4x.ch/music")
print(page.readlines())


opener.open() call ends with error for every page requiring login via prompt_user_password(). urllib/request.py tries to encode password with base64 without conversion to bytes which is required for base64.b64encode() in Python 3.1. Even after applying conversion to bytes, another new error is generated
msg221812 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-28 18:41
@Senthil can you follow up on this please.
msg393186 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2021-05-07 14:11
urllib.request.FancyURLopener has been deprecated since 3.3

https://docs.python.org/3/library/urllib.request.html#urllib.request.FancyURLopener

This bug wont be fixed. The other higher level methods (urlopen) could used for basic authentication with username and password.
History
Date User Action Args
2022-04-11 14:57:05adminsetgithub: 53934
2021-05-07 14:11:16orsenthilsetstatus: open -> closed
resolution: wont fix
messages: + msg393186

stage: resolved
2019-03-16 00:03:45BreamoreBoysetnosy: - BreamoreBoy
2014-06-28 18:41:19BreamoreBoysetnosy: + BreamoreBoy

messages: + msg221812
versions: + Python 3.4, Python 3.5, - Python 3.1
2011-12-20 15:13:21joneskoosetnosy: + joneskoo
2010-10-04 12:50:39orsenthilsetassignee: orsenthil

nosy: + orsenthil
2010-08-31 17:05:35petr6.6create