mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 19:52:54 +01:00
utils.web.getUrl: add the 'timeout' argument (and fix the doc of getUrlFd).
Signed-off-by: James McCoy <vega.james@gmail.com>
This commit is contained in:
parent
2fda75e1b2
commit
b99ff28e33
@ -99,7 +99,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."""
|
||||
@ -136,13 +136,13 @@ def getUrlFd(url, headers=None, data=None, timeout=None):
|
||||
except ValueError, 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