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

Delta Between Two Patch Sets: Doc/library/ipaddress.rst

Issue 20480: Add ipaddress property to get reverse DNS name
Left Patch Set: Created 5 years, 10 months ago
Right Patch Set: Created 5 years, 10 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | Lib/ipaddress.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 :mod:`ipaddress` --- IPv4/IPv6 manipulation library 1 :mod:`ipaddress` --- IPv4/IPv6 manipulation library
2 =================================================== 2 ===================================================
3 3
4 .. module:: ipaddress 4 .. module:: ipaddress
5 :synopsis: IPv4/IPv6 manipulation library. 5 :synopsis: IPv4/IPv6 manipulation library.
6 .. moduleauthor:: Peter Moody 6 .. moduleauthor:: Peter Moody
7 7
8 **Source code:** :source:`Lib/ipaddress.py` 8 **Source code:** :source:`Lib/ipaddress.py`
9 9
10 -------------- 10 --------------
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 set to zero, these two attributes are always the same as ``str(addr)`` 146 set to zero, these two attributes are always the same as ``str(addr)``
147 for IPv4 addresses. Exposing these attributes makes it easier to 147 for IPv4 addresses. Exposing these attributes makes it easier to
148 write display code that can handle both IPv4 and IPv6 addresses. 148 write display code that can handle both IPv4 and IPv6 addresses.
149 149
150 .. attribute:: packed 150 .. attribute:: packed
151 151
152 The binary representation of this address - a :class:`bytes` object of 152 The binary representation of this address - a :class:`bytes` object of
153 the appropriate length (most significant octet first). This is 4 bytes 153 the appropriate length (most significant octet first). This is 4 bytes
154 for IPv4 and 16 bytes for IPv6. 154 for IPv4 and 16 bytes for IPv6.
155 155
156 .. attribute:: reverse_name 156 .. attribute:: reverse_pointer
157 157
158 The reverse DNS name of the IP address, e.g.:: 158 The name of the reverse DNS PTR record for the IP address, e.g.::
159 159
160 >>> ipaddress.ip_address("127.0.0.1").reverse_name 160 >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
161 '1.0.0.127.in-addr.arpa.' 161 '1.0.0.127.in-addr.arpa'
162 >>> ipaddress.ip_address("2001:db8::1").reverse_name 162 >>> ipaddress.ip_address("2001:db8::1").reverse_pointer
163 '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.a rpa.' 163 '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.a rpa'
164 164
165 This is the name that could be used for performing a PTR lookup, not the
166 resolved hostname itself.
167
168 .. versionadded:: 3.5
165 169
166 .. attribute:: is_multicast 170 .. attribute:: is_multicast
167 171
168 ``True`` if the address is reserved for multicast use. See 172 ``True`` if the address is reserved for multicast use. See
169 :RFC:`3171` (for IPv4) or :RFC:`2373` (for IPv6). 173 :RFC:`3171` (for IPv4) or :RFC:`2373` (for IPv6).
170 174
171 .. attribute:: is_private 175 .. attribute:: is_private
172 176
173 ``True`` if the address is allocated for private networks. See 177 ``True`` if the address is allocated for private networks. See
174 iana-ipv4-special-registry (for IPv4) or iana-ipv6-special-registry 178 iana-ipv4-special-registry (for IPv4) or iana-ipv6-special-registry
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 zeroes collapsed to a single empty group. 233 zeroes collapsed to a single empty group.
230 234
231 This is also the value returned by ``str(addr)`` for IPv6 addresses. 235 This is also the value returned by ``str(addr)`` for IPv6 addresses.
232 236
233 .. attribute:: exploded 237 .. attribute:: exploded
234 238
235 The long form of the address representation, with all leading zeroes and 239 The long form of the address representation, with all leading zeroes and
236 groups consisting entirely of zeroes included. 240 groups consisting entirely of zeroes included.
237 241
238 .. attribute:: packed 242 .. attribute:: packed
239 .. attribute:: reverse_name 243 .. attribute:: reverse_pointer
240 .. attribute:: version 244 .. attribute:: version
241 .. attribute:: max_prefixlen 245 .. attribute:: max_prefixlen
242 .. attribute:: is_multicast 246 .. attribute:: is_multicast
243 .. attribute:: is_private 247 .. attribute:: is_private
244 .. attribute:: is_unspecified 248 .. attribute:: is_unspecified
245 .. attribute:: is_reserved 249 .. attribute:: is_reserved
246 .. attribute:: is_loopback 250 .. attribute:: is_loopback
247 .. attribute:: is_link_local 251 .. attribute:: is_link_local
248 252
249 Refer to the corresponding attribute documentation in 253 Refer to the corresponding attribute documentation in
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 module defines the following exceptions: 819 module defines the following exceptions:
816 820
817 .. exception:: AddressValueError(ValueError) 821 .. exception:: AddressValueError(ValueError)
818 822
819 Any value error related to the address. 823 Any value error related to the address.
820 824
821 825
822 .. exception:: NetmaskValueError(ValueError) 826 .. exception:: NetmaskValueError(ValueError)
823 827
824 Any value error related to the netmask. 828 Any value error related to the netmask.
LEFTRIGHT
« no previous file | Lib/ipaddress.py » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

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