tools/web: use core xml minidom instead of nemubot xml parser
This commit is contained in:
parent
089823d884
commit
56c43179f3
@ -1,5 +1,3 @@
|
|||||||
# coding=utf-8
|
|
||||||
|
|
||||||
# Nemubot is a smart and modulable IM bot.
|
# Nemubot is a smart and modulable IM bot.
|
||||||
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
|
# Copyright (C) 2012-2015 Mercier Pierre-Olivier
|
||||||
#
|
#
|
||||||
@ -176,8 +174,8 @@ def getXML(url, timeout=7):
|
|||||||
if cnt is None:
|
if cnt is None:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
from nemubot.tools.xmlparser import parse_string
|
from xml.dom.minidom import parseString
|
||||||
return parse_string(cnt.encode())
|
return parseString(cnt)
|
||||||
|
|
||||||
|
|
||||||
def getJSON(url, timeout=7):
|
def getJSON(url, timeout=7):
|
||||||
@ -188,12 +186,11 @@ def getJSON(url, timeout=7):
|
|||||||
timeout -- maximum number of seconds to wait before returning an exception
|
timeout -- maximum number of seconds to wait before returning an exception
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
cnt = getURLContent(url, timeout=timeout)
|
cnt = getURLContent(url, timeout=timeout)
|
||||||
if cnt is None:
|
if cnt is None:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
|
import json
|
||||||
return json.loads(cnt)
|
return json.loads(cnt)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user