Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1b7f9e53
Commit
1b7f9e53
authored
May 01, 2010
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue8582: urllib.urlretrieve fails with ValueError: Invalid format string
parent
d3b6022d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
Lib/test/test_urllibnet.py
Lib/test/test_urllibnet.py
+13
-0
Lib/urllib.py
Lib/urllib.py
+1
-1
No files found.
Lib/test/test_urllibnet.py
View file @
1b7f9e53
...
...
@@ -7,6 +7,8 @@ import socket
import
urllib
import
sys
import
os
import
time
mimetools
=
test_support
.
import_module
(
"mimetools"
,
deprecated
=
True
)
...
...
@@ -178,6 +180,17 @@ class urlretrieveNetworkTests(unittest.TestCase):
self
.
assertIsInstance
(
header
,
mimetools
.
Message
,
"header is not an instance of mimetools.Message"
)
def
test_data_header
(
self
):
logo
=
"http://www.python.org/community/logos/python-logo-master-v3-TM.png"
file_location
,
fileheaders
=
self
.
urlretrieve
(
logo
)
os
.
unlink
(
file_location
)
datevalue
=
fileheaders
.
getheader
(
'Date'
)
dateformat
=
'%a, %d %b %Y %H:%M:%S GMT'
try
:
time
.
strptime
(
datevalue
,
dateformat
)
except
ValueError
:
self
.
fail
(
'Date value not in %r format'
,
dateformat
)
def
test_main
():
...
...
Lib/urllib.py
View file @
1b7f9e53
...
...
@@ -588,7 +588,7 @@ class URLopener:
else
:
encoding
=
''
msg
=
[]
msg
.
append
(
'Date: %s'
%
time
.
strftime
(
'%a, %d %b %Y %
T
GMT'
,
msg
.
append
(
'Date: %s'
%
time
.
strftime
(
'%a, %d %b %Y %
H:%M:%S
GMT'
,
time
.
gmtime
(
time
.
time
())))
msg
.
append
(
'Content-type: %s'
%
type
)
if
encoding
==
'base64'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment