Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
4519a83c
Commit
4519a83c
authored
Jan 12, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
evdns: drop dns_ prefix from function names
parent
1da2c497
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
gevent/evdns.py
gevent/evdns.py
+11
-11
gevent/socket.py
gevent/socket.py
+5
-5
No files found.
gevent/evdns.py
View file @
4519a83c
...
...
@@ -2,14 +2,14 @@
This module contains synchronous wrappers around some of the libevent DNS API.
>>>
dns_
resolve_ipv4('www.python.org')
>>> resolve_ipv4('www.python.org')
['82.94.164.162']
>>>
dns_
resolve_reverse('82.94.164.162').endswith('python.org')
>>> resolve_reverse('82.94.164.162').endswith('python.org')
True
The errors are reported through a subclass of :class:`socket.gaierror`.
>>>
dns_
resolve_ipv4('aaaaaaaaaaa')
>>> resolve_ipv4('aaaaaaaaaaa')
Traceback (most recent call last):
...
DNSError: [Errno 3] name does not exist
...
...
@@ -22,10 +22,10 @@ from gevent.core import DNS_QUERY_NO_SEARCH as QUERY_NO_SEARCH
__all__
=
[
'DNSError'
,
'
dns_
resolve_ipv4'
,
'
dns_
resolve_ipv6'
,
'
dns_
resolve_reverse'
,
'
dns_
resolve_reverse_ipv6'
,
'resolve_ipv4'
,
'resolve_ipv6'
,
'resolve_reverse'
,
'resolve_reverse_ipv6'
,
'QUERY_NO_SEARCH'
]
...
...
@@ -47,7 +47,7 @@ class DNSError(gaierror):
gaierror
.
__init__
(
self
,
*
args
)
def
dns_
resolve_ipv4
(
name
,
flags
=
0
):
def
resolve_ipv4
(
name
,
flags
=
0
):
waiter
=
Waiter
()
core
.
dns_resolve_ipv4
(
name
,
flags
,
waiter
.
switch_args
)
result
,
_type
,
_ttl
,
addrs
=
waiter
.
get
()
...
...
@@ -57,7 +57,7 @@ def dns_resolve_ipv4(name, flags=0):
# QQQ would be nice to have ttl as an attribute
def
dns_
resolve_ipv6
(
name
,
flags
=
0
):
def
resolve_ipv6
(
name
,
flags
=
0
):
waiter
=
Waiter
()
core
.
dns_resolve_ipv6
(
name
,
flags
,
waiter
.
switch_args
)
result
,
_type
,
_ttl
,
addrs
=
waiter
.
get
()
...
...
@@ -66,7 +66,7 @@ def dns_resolve_ipv6(name, flags=0):
return
addrs
def
dns_
resolve_reverse
(
ip
,
flags
=
0
):
def
resolve_reverse
(
ip
,
flags
=
0
):
waiter
=
Waiter
()
core
.
dns_resolve_reverse
(
ip
,
flags
,
waiter
.
switch_args
)
result
,
_type
,
_ttl
,
addr
=
waiter
.
get
()
...
...
@@ -75,7 +75,7 @@ def dns_resolve_reverse(ip, flags=0):
return
addr
def
dns_
resolve_reverse_ipv6
(
ip
,
flags
=
0
):
def
resolve_reverse_ipv6
(
ip
,
flags
=
0
):
waiter
=
Waiter
()
core
.
dns_resolve_reverse_ipv6
(
ip
,
flags
,
waiter
.
switch_args
)
result
,
_type
,
_ttl
,
addrs
=
waiter
.
get
()
...
...
gevent/socket.py
View file @
4519a83c
...
...
@@ -681,7 +681,7 @@ def wrap_ssl000(sock, keyfile=None, certfile=None):
return
ssl_sock
try
:
from
gevent.evdns
import
dns_resolve_ipv4
,
dns_
resolve_ipv6
from
gevent.evdns
import
resolve_ipv4
,
resolve_ipv6
except
:
import
traceback
traceback
.
print_exc
()
...
...
@@ -709,7 +709,7 @@ else:
return
hostname
if
hostname
==
_socket
.
gethostname
():
return
_socket
.
gethostbyname
(
hostname
)
addrs
=
dns_
resolve_ipv4
(
hostname
)
addrs
=
resolve_ipv4
(
hostname
)
return
random
.
choice
(
addrs
)
...
...
@@ -719,7 +719,7 @@ else:
If *host* is not a string, does not has any dots or is a numeric IP address, then
the standard :func:`socket.getaddrinfo` is called.
Otherwise, calls either :func:`
dns_resolve_ipv4` or :func:`dns_
resolve_ipv6` and
Otherwise, calls either :func:`
resolve_ipv4` or :func:`
resolve_ipv6` and
formats the result the way :func:`socket.getaddrinfo` does it.
Differs in the following ways:
...
...
@@ -746,9 +746,9 @@ else:
if
family
in
(
None
,
AF_INET
,
AF_UNSPEC
):
family
=
AF_INET
# TODO: AF_UNSPEC means try both AF_INET and AF_INET6
addrs
=
dns_
resolve_ipv4
(
host
,
evdns_flags
)
addrs
=
resolve_ipv4
(
host
,
evdns_flags
)
elif
family
==
AF_INET6
:
addrs
=
dns_
resolve_ipv6
(
host
,
evdns_flags
)
addrs
=
resolve_ipv6
(
host
,
evdns_flags
)
else
:
raise
NotImplementedError
(
'family is not among AF_UNSPEC/AF_INET/AF_INET6: %r'
%
(
family
,
))
r
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment