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

Side by Side Diff: Doc/library/urllib.parse.rst

Issue 23684: urlparse() documentation does not account for default scheme
Patch Set: Created 4 years, 6 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 | « no previous file | Lib/test/test_urlparse.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`urllib.parse` --- Parse URLs into components 1 :mod:`urllib.parse` --- Parse URLs into components
2 ================================================== 2 ==================================================
3 3
4 .. module:: urllib.parse 4 .. module:: urllib.parse
5 :synopsis: Parse URLs into or assemble them from components. 5 :synopsis: Parse URLs into or assemble them from components.
6 6
7 7
8 .. index:: 8 .. index::
9 single: WWW 9 single: WWW
10 single: World Wide Web 10 single: World Wide Web
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 >>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html') 69 >>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')
70 ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python.htm l', 70 ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python.htm l',
71 params='', query='', fragment='') 71 params='', query='', fragment='')
72 >>> urlparse('www.cwi.nl/%7Eguido/Python.html') 72 >>> urlparse('www.cwi.nl/%7Eguido/Python.html')
73 ParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html', 73 ParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',
74 params='', query='', fragment='') 74 params='', query='', fragment='')
75 >>> urlparse('help/Python.html') 75 >>> urlparse('help/Python.html')
76 ParseResult(scheme='', netloc='', path='help/Python.html', params='', 76 ParseResult(scheme='', netloc='', path='help/Python.html', params='',
77 query='', fragment='') 77 query='', fragment='')
78 78
79 If the *scheme* argument is specified, it gives the default addressing 79 The *scheme* argument gives the default addressing scheme, to be
80 scheme, to be used only if the URL does not specify one. The default value f or 80 used only if the URL does not specify one. It should be the same type
81 this argument is the empty string. 81 (text or bytes) as *urlstring*, except that the default value ``''`` is
82 always allowed, and is automatically converted to ``b''`` if appropriate.
82 83
83 If the *allow_fragments* argument is false, fragment identifiers are not 84 If the *allow_fragments* argument is false, fragment identifiers are not
84 recognized and parsed as part of the preceding component. The default value 85 recognized. Instead, they are parsed as part of the path, parameters
85 for this argument is :const:`True`. 86 or query component, and :attr:`fragment` is set to the empty string in
87 the return value.
86 88
87 The return value is actually an instance of a subclass of :class:`tuple`. Th is 89 The return value is actually an instance of a subclass of :class:`tuple`. Th is
88 class has the following additional read-only convenience attributes: 90 class has the following additional read-only convenience attributes:
89 91
90 +------------------+-------+--------------------------+---------------------- + 92 +------------------+-------+--------------------------+---------------------- +
91 | Attribute | Index | Value | Value if not present | 93 | Attribute | Index | Value | Value if not present |
92 +==================+=======+==========================+====================== + 94 +==================+=======+==========================+====================== +
93 | :attr:`scheme` | 0 | URL scheme specifier | empty string | 95 | :attr:`scheme` | 0 | URL scheme specifier | *scheme* argument |
berkerpeksag 2015/06/22 00:01:42 "argument" looks incorrect to me. Can this be "val
Martin Panter 2015/06/22 01:31:25 Yes “*scheme* parameter” would be good. Originally
94 +------------------+-------+--------------------------+---------------------- + 96 +------------------+-------+--------------------------+---------------------- +
95 | :attr:`netloc` | 1 | Network location part | empty string | 97 | :attr:`netloc` | 1 | Network location part | empty string |
96 +------------------+-------+--------------------------+---------------------- + 98 +------------------+-------+--------------------------+---------------------- +
97 | :attr:`path` | 2 | Hierarchical path | empty string | 99 | :attr:`path` | 2 | Hierarchical path | empty string |
98 +------------------+-------+--------------------------+---------------------- + 100 +------------------+-------+--------------------------+---------------------- +
99 | :attr:`params` | 3 | Parameters for last path | empty string | 101 | :attr:`params` | 3 | Parameters for last path | empty string |
100 | | | element | | 102 | | | element | |
101 +------------------+-------+--------------------------+---------------------- + 103 +------------------+-------+--------------------------+---------------------- +
102 | :attr:`query` | 4 | Query component | empty string | 104 | :attr:`query` | 4 | Query component | empty string |
103 +------------------+-------+--------------------------+---------------------- + 105 +------------------+-------+--------------------------+---------------------- +
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 of the URL (see :rfc:`2396`) is wanted. A separate function is needed to 201 of the URL (see :rfc:`2396`) is wanted. A separate function is needed to
200 separate the path segments and parameters. This function returns a 5-tuple: 202 separate the path segments and parameters. This function returns a 5-tuple:
201 (addressing scheme, network location, path, query, fragment identifier). 203 (addressing scheme, network location, path, query, fragment identifier).
202 204
203 The return value is actually an instance of a subclass of :class:`tuple`. Th is 205 The return value is actually an instance of a subclass of :class:`tuple`. Th is
204 class has the following additional read-only convenience attributes: 206 class has the following additional read-only convenience attributes:
205 207
206 +------------------+-------+-------------------------+----------------------+ 208 +------------------+-------+-------------------------+----------------------+
207 | Attribute | Index | Value | Value if not present | 209 | Attribute | Index | Value | Value if not present |
208 +==================+=======+=========================+======================+ 210 +==================+=======+=========================+======================+
209 | :attr:`scheme` | 0 | URL scheme specifier | empty string | 211 | :attr:`scheme` | 0 | URL scheme specifier | *scheme* argument |
210 +------------------+-------+-------------------------+----------------------+ 212 +------------------+-------+-------------------------+----------------------+
211 | :attr:`netloc` | 1 | Network location part | empty string | 213 | :attr:`netloc` | 1 | Network location part | empty string |
212 +------------------+-------+-------------------------+----------------------+ 214 +------------------+-------+-------------------------+----------------------+
213 | :attr:`path` | 2 | Hierarchical path | empty string | 215 | :attr:`path` | 2 | Hierarchical path | empty string |
214 +------------------+-------+-------------------------+----------------------+ 216 +------------------+-------+-------------------------+----------------------+
215 | :attr:`query` | 3 | Query component | empty string | 217 | :attr:`query` | 3 | Query component | empty string |
216 +------------------+-------+-------------------------+----------------------+ 218 +------------------+-------+-------------------------+----------------------+
217 | :attr:`fragment` | 4 | Fragment identifier | empty string | 219 | :attr:`fragment` | 4 | Fragment identifier | empty string |
218 +------------------+-------+-------------------------+----------------------+ 220 +------------------+-------+-------------------------+----------------------+
219 | :attr:`username` | | User name | :const:`None` | 221 | :attr:`username` | | User name | :const:`None` |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 :rfc:`2368` - The mailto URL scheme. 583 :rfc:`2368` - The mailto URL scheme.
582 Parsing requirements for mailto url schemes. 584 Parsing requirements for mailto url schemes.
583 585
584 :rfc:`1808` - Relative Uniform Resource Locators 586 :rfc:`1808` - Relative Uniform Resource Locators
585 This Request For Comments includes the rules for joining an absolute and a 587 This Request For Comments includes the rules for joining an absolute and a
586 relative URL, including a fair number of "Abnormal Examples" which govern the 588 relative URL, including a fair number of "Abnormal Examples" which govern the
587 treatment of border cases. 589 treatment of border cases.
588 590
589 :rfc:`1738` - Uniform Resource Locators (URL) 591 :rfc:`1738` - Uniform Resource Locators (URL)
590 This specifies the formal syntax and semantics of absolute URLs. 592 This specifies the formal syntax and semantics of absolute URLs.
OLDNEW
« no previous file with comments | « no previous file | Lib/test/test_urlparse.py » ('j') | no next file with comments »

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