mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
utils.web.getUrl: add the 'timeout' argument (and fix the doc of getUrlFd).
This commit is contained in:
parent
34fd545b76
commit
9210aa1a33
@ -102,7 +102,7 @@ defaultHeaders = {
|
||||
proxy = None
|
||||
|
||||
def getUrlFd(url, headers=None, data=None, timeout=None):
|
||||
"""getUrlFd(url, headers=None, data=None)
|
||||
"""getUrlFd(url, headers=None, data=None, timeout=None)
|
||||
|
||||
Opens the given url and returns a file object. Headers and data are
|
||||
a dict and string, respectively, as per urllib2.Request's arguments."""
|
||||
@ -139,13 +139,13 @@ def getUrlFd(url, headers=None, data=None, timeout=None):
|
||||
except ValueError as e:
|
||||
raise Error(strError(e))
|
||||
|
||||
def getUrl(url, size=None, headers=None, data=None):
|
||||
"""getUrl(url, size=None, headers=None, data=None)
|
||||
def getUrl(url, size=None, headers=None, data=None, timeout=None):
|
||||
"""getUrl(url, size=None, headers=None, data=None, timeout=None)
|
||||
|
||||
Gets a page. Returns a string that is the page gotten. Size is an integer
|
||||
number of bytes to read from the URL. Headers and data are dicts as per
|
||||
urllib2.Request's arguments."""
|
||||
fd = getUrlFd(url, headers=headers, data=data)
|
||||
fd = getUrlFd(url, headers=headers, data=data, timeout=timeout)
|
||||
try:
|
||||
if size is None:
|
||||
text = fd.read()
|
||||
|
Loading…
Reference in New Issue
Block a user