diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2012-10-09 08:03:35 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2012-10-09 08:03:35 (GMT) |
commit | 7c06801638d24a8d7fe7223b5200bf466a31eeea (patch) | |
tree | a28db68d8ac76d763e91621204aaa92057e62dab /Doc/howto/urllib2.rst | |
parent | 6ecdb581544698830b2623f1f9e2c2c9baacd219 (diff) | |
download | cpython-7c06801638d24a8d7fe7223b5200bf466a31eeea.zip cpython-7c06801638d24a8d7fe7223b5200bf466a31eeea.tar.gz cpython-7c06801638d24a8d7fe7223b5200bf466a31eeea.tar.bz2 |
Fix Issue 15922: make howto/urllib2.rst doctests pass.
Patch by Chris Jerdonek. Address Ezio's review comment.
Diffstat (limited to 'Doc/howto/urllib2.rst')
-rw-r--r-- | Doc/howto/urllib2.rst | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst index e93473a..fe77d13 100644 --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -134,7 +134,7 @@ This is done as follows:: >>> data['location'] = 'Northampton' >>> data['language'] = 'Python' >>> url_values = urllib.urlencode(data) - >>> print url_values + >>> print url_values # The order may differ. #doctest: +SKIP name=Somebody+Here&language=Python&location=Northampton >>> url = 'http://www.example.com/example.cgi' >>> full_url = url + '?' + url_values @@ -201,9 +201,9 @@ e.g. :: >>> req = urllib2.Request('http://www.pretend_server.org') >>> try: urllib2.urlopen(req) - >>> except URLError, e: - >>> print e.reason - >>> + ... except URLError, e: + ... print e.reason #doctest: +SKIP + ... (4, 'getaddrinfo failed') @@ -309,18 +309,18 @@ geturl, and info, methods. :: >>> req = urllib2.Request('http://www.python.org/fish.html') >>> try: - >>> urllib2.urlopen(req) - >>> except HTTPError, e: - >>> print e.code - >>> print e.read() - >>> + ... urllib2.urlopen(req) + ... except urllib2.HTTPError, e: + ... print e.code + ... print e.read() #doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE + ... 404 - <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - <?xml-stylesheet href="./css/ht2html.css" - type="text/css"?> - <html><head><title>Error 404: File Not Found</title> - ...... etc... + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + ... + <title>Page Not Found</title> + ... + Wrapping it Up -------------- |