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.

Title: Http redirection error in
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: dehn, georg.brandl, jjlee, vstinner
Priority: normal Keywords:

Created on 2005-11-10 20:25 by dehn, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit dehn, 2005-11-10 20:25 Python library source file
Messages (4)
msg26836 - (view) Author: Thomas Dehn (dehn) Date: 2005-11-10 20:25
A url request returns a redirect that contains a space '  ' 
character. Python does not replace this 
character with '%20' and fails.

Entering a line after line 507 of:
            newurl=re.sub(' ','%20',newurl)
Corrects my problem.
msg26837 - (view) Author: John J Lee (jjlee) Date: 2006-02-01 20:28
Logged In: YES 

The problem is more general, so perhaps:

URLQUOTE_SAFE_URL_CHARS = "!*'();:@&=+$,/?%#[]~"
newurl = urllib.quote(url, URLQUOTE_SAFE_URL_CHARS)

Caveat: I still haven't read RFCs 3986/3987...
msg26838 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-03-18 11:35
Logged In: YES 

Added a fix in rev. 43132.
msg339838 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-04-10 09:13
> Added a fix in rev. 43132.

In Git, it became the commit:

commit ddb84d7c69addc5d5e2ab3e327260d97b52af3a7
Author: Georg Brandl <>
Date:   Sat Mar 18 11:35:18 2006 +0000

    Bug #1353433: be conciliant with spaces in redirect URLs
Date User Action Args
2022-04-11 14:56:14adminsetgithub: 42579
2019-04-10 09:13:08vstinnersetnosy: + vstinner
messages: + msg339838
2005-11-10 20:25:56dehncreate