Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Side by Side Diff: Doc/howto/urllib2.rst

Issue 18758: Fix internal references in the documentation
Patch Set: Created 6 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/howto/unicode.rst ('k') | Doc/library/2to3.rst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 .. _urllib-howto: 1 .. _urllib-howto:
2 2
3 *********************************************************** 3 ***********************************************************
4 HOWTO Fetch Internet Resources Using The urllib Package 4 HOWTO Fetch Internet Resources Using The urllib Package
5 *********************************************************** 5 ***********************************************************
6 6
7 :Author: `Michael Foord <http://www.voidspace.org.uk/python/index.shtml>`_ 7 :Author: `Michael Foord <http://www.voidspace.org.uk/python/index.shtml>`_
8 8
9 .. note:: 9 .. note::
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 Fetching URLs 50 Fetching URLs
51 ============= 51 =============
52 52
53 The simplest way to use urllib.request is as follows:: 53 The simplest way to use urllib.request is as follows::
54 54
55 import urllib.request 55 import urllib.request
56 response = urllib.request.urlopen('http://python.org/') 56 response = urllib.request.urlopen('http://python.org/')
57 html = response.read() 57 html = response.read()
58 58
59 If you wish to retrieve a resource via URL and store it in a temporary location, 59 If you wish to retrieve a resource via URL and store it in a temporary location,
60 you can do so via the :func:`urlretrieve` function:: 60 you can do so via the :func:`~urllib.request.urlretrieve` function::
61 61
62 import urllib.request 62 import urllib.request
63 local_filename, headers = urllib.request.urlretrieve('http://python.org/') 63 local_filename, headers = urllib.request.urlretrieve('http://python.org/')
64 html = open(local_filename) 64 html = open(local_filename)
65 65
66 Many uses of urllib will be that simple (note that instead of an 'http:' URL we 66 Many uses of urllib will be that simple (note that instead of an 'http:' URL we
67 could have used an URL starting with 'ftp:', 'file:', etc.). However, it's the 67 could have used an URL starting with 'ftp:', 'file:', etc.). However, it's the
68 purpose of this tutorial to explain the more complicated cases, concentrating on 68 purpose of this tutorial to explain the more complicated cases, concentrating on
69 HTTP. 69 HTTP.
70 70
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 .. [#] For details of more HTTP request headers, see 586 .. [#] For details of more HTTP request headers, see
587 `Quick Reference to HTTP Headers`_. 587 `Quick Reference to HTTP Headers`_.
588 .. [#] In my case I have to use a proxy to access the internet at work. If you 588 .. [#] In my case I have to use a proxy to access the internet at work. If you
589 attempt to fetch *localhost* URLs through this proxy it blocks them. IE 589 attempt to fetch *localhost* URLs through this proxy it blocks them. IE
590 is set to use the proxy, which urllib picks up on. In order to test 590 is set to use the proxy, which urllib picks up on. In order to test
591 scripts with a localhost server, I have to prevent urllib from using 591 scripts with a localhost server, I have to prevent urllib from using
592 the proxy. 592 the proxy.
593 .. [#] urllib opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe 593 .. [#] urllib opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe
594 <http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/456195>`_. 594 <http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/456195>`_.
595 595
OLDNEW
« no previous file with comments | « Doc/howto/unicode.rst ('k') | Doc/library/2to3.rst » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+