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
7c068016
Commit
7c068016
authored
Oct 09, 2012
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Issue 15922: make howto/urllib2.rst doctests pass.
Patch by Chris Jerdonek. Address Ezio's review comment.
parent
6ecdb581
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
Doc/howto/urllib2.rst
Doc/howto/urllib2.rst
+15
-15
No files found.
Doc/howto/urllib2.rst
View file @
7c068016
...
@@ -134,7 +134,7 @@ This is done as follows::
...
@@ -134,7 +134,7 @@ This is done as follows::
>>> data['location'] = 'Northampton'
>>> data['location'] = 'Northampton'
>>> data['language'] = 'Python'
>>> data['language'] = 'Python'
>>> url_values = urllib.urlencode(data)
>>> url_values = urllib.urlencode(data)
>>> print url_values
>>> print url_values
# The order may differ. #doctest: +SKIP
name=Somebody+Here&language=Python&location=Northampton
name=Somebody+Here&language=Python&location=Northampton
>>> url = 'http://www.example.com/example.cgi'
>>> url = 'http://www.example.com/example.cgi'
>>> full_url = url + '?' + url_values
>>> full_url = url + '?' + url_values
...
@@ -201,9 +201,9 @@ e.g. ::
...
@@ -201,9 +201,9 @@ e.g. ::
>>> req = urllib2.Request('http://www.pretend_server.org')
>>> req = urllib2.Request('http://www.pretend_server.org')
>>> try: urllib2.urlopen(req)
>>> try: urllib2.urlopen(req)
>>>
except URLError, e:
...
except URLError, e:
>>> print e.reason
... print e.reason #doctest: +SKIP
>>>
...
(4, 'getaddrinfo failed')
(4, 'getaddrinfo failed')
...
@@ -309,18 +309,18 @@ geturl, and info, methods. ::
...
@@ -309,18 +309,18 @@ geturl, and info, methods. ::
>>> req = urllib2.Request('http://www.python.org/fish.html')
>>> req = urllib2.Request('http://www.python.org/fish.html')
>>> try:
>>> try:
>>>
urllib2.urlopen(req)
...
urllib2.urlopen(req)
>>> except
HTTPError, e:
... except urllib2.
HTTPError, e:
>>>
print e.code
...
print e.code
>>> print e.read()
... print e.read() #doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
>>>
...
404
404
<!DOCTYPE html PUBLIC "-//W3C//DTD
HTML 4.01
Transitional//EN"
<!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/html4/loose
.dtd">
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional
.dtd">
<?xml-stylesheet href="./css/ht2html.css"
...
type="text/css"?
>
<title>Page Not Found</title
>
<html><head><title>
Error 404: File Not Found
</title>
...
...... etc...
Wrapping it Up
Wrapping it Up
--------------
--------------
...
...
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