mirror of https://github.com/flaggo/pydu.git
add doc for request.check_connect
This commit is contained in:
parent
72cdcf31bd
commit
780c7b72a1
|
@ -23,3 +23,14 @@ Request
|
|||
``url`` indicates which url to download.
|
||||
``dst`` is the filename or directory of destination. ``None`` as default, means
|
||||
download to current directory.
|
||||
|
||||
|
||||
.. py:function:: pydu.request.check_connect(p, port, retry=1, timeout=0.5)
|
||||
|
||||
Check whether given ``ip`` and ``port`` could connect or not.
|
||||
It will ``retry`` and ``timeout`` on given.
|
||||
|
||||
>>> from pydu.request import check_connect
|
||||
>>> check_connect('http://www.baidu.com', 80)
|
||||
'192.168.3.8'
|
||||
>>>
|
||||
|
|
|
@ -104,8 +104,8 @@ def download(url, dst=None):
|
|||
|
||||
def check_connect(ip, port, retry=1, timeout=0.5):
|
||||
"""
|
||||
Check whether given ip and port could connect or not.
|
||||
It will retry and timeout on given.
|
||||
Check whether given ``ip`` and ``port`` could connect or not.
|
||||
It will ``retry`` and ``timeout`` on given.
|
||||
"""
|
||||
while retry:
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue