From 6ac9fc48572d9705a1a5a0400e6d8b279dc12454 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Tue, 4 Jul 2017 06:53:34 +0200 Subject: [PATCH] tools/web: forward all arguments passed to getJSON and getXML to getURLContent --- nemubot/tools/web.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/nemubot/tools/web.py b/nemubot/tools/web.py index d35740c..dc967be 100644 --- a/nemubot/tools/web.py +++ b/nemubot/tools/web.py @@ -162,15 +162,13 @@ def getURLContent(url, body=None, timeout=7, header=None): (res.status, http.client.responses[res.status])) -def getXML(url, timeout=7): +def getXML(*args, **kwargs): """Get content page and return XML parsed content - Arguments: - url -- the URL to get - timeout -- maximum number of seconds to wait before returning an exception + Arguments: same as getURLContent """ - cnt = getURLContent(url, timeout=timeout) + cnt = getURLContent(*args, **kwargs) if cnt is None: return None else: @@ -178,15 +176,13 @@ def getXML(url, timeout=7): return parseString(cnt) -def getJSON(url, timeout=7): +def getJSON(*args, **kwargs): """Get content page and return JSON content - Arguments: - url -- the URL to get - timeout -- maximum number of seconds to wait before returning an exception + Arguments: same as getURLContent """ - cnt = getURLContent(url, timeout=timeout) + cnt = getURLContent(*args, **kwargs) if cnt is None: return None else: