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

Side by Side Diff: Doc/library/ipaddress.rst

Issue 20480: Add ipaddress property to get reverse DNS name
Patch Set: Created 5 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/ipaddress.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:`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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 As IPv4 does not define a shorthand notation for addresses with octets 145 As IPv4 does not define a shorthand notation for addresses with octets
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
156 .. attribute:: reverse_pointer
157
158 The name of the reverse DNS PTR record for the IP address, e.g.::
159
160 >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
161 '1.0.0.127.in-addr.arpa.'
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.'
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
155 169
156 .. attribute:: is_multicast 170 .. attribute:: is_multicast
157 171
158 ``True`` if the address is reserved for multicast use. See 172 ``True`` if the address is reserved for multicast use. See
159 :RFC:`3171` (for IPv4) or :RFC:`2373` (for IPv6). 173 :RFC:`3171` (for IPv4) or :RFC:`2373` (for IPv6).
160 174
161 .. attribute:: is_private 175 .. attribute:: is_private
162 176
163 ``True`` if the address is allocated for private networks. See 177 ``True`` if the address is allocated for private networks. See
164 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
219 zeroes collapsed to a single empty group. 233 zeroes collapsed to a single empty group.
220 234
221 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.
222 236
223 .. attribute:: exploded 237 .. attribute:: exploded
224 238
225 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
226 groups consisting entirely of zeroes included. 240 groups consisting entirely of zeroes included.
227 241
228 .. attribute:: packed 242 .. attribute:: packed
243 .. attribute:: reverse_pointer
229 .. attribute:: version 244 .. attribute:: version
230 .. attribute:: max_prefixlen 245 .. attribute:: max_prefixlen
231 .. attribute:: is_multicast 246 .. attribute:: is_multicast
232 .. attribute:: is_private 247 .. attribute:: is_private
233 .. attribute:: is_unspecified 248 .. attribute:: is_unspecified
234 .. attribute:: is_reserved 249 .. attribute:: is_reserved
235 .. attribute:: is_loopback 250 .. attribute:: is_loopback
236 .. attribute:: is_link_local 251 .. attribute:: is_link_local
237 252
238 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
804 module defines the following exceptions: 819 module defines the following exceptions:
805 820
806 .. exception:: AddressValueError(ValueError) 821 .. exception:: AddressValueError(ValueError)
807 822
808 Any value error related to the address. 823 Any value error related to the address.
809 824
810 825
811 .. exception:: NetmaskValueError(ValueError) 826 .. exception:: NetmaskValueError(ValueError)
812 827
813 Any value error related to the netmask. 828 Any value error related to the netmask.
OLDNEW
« no previous file with comments | « no previous file | Lib/ipaddress.py » ('j') | no next file with comments »

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