Move xmlparser to tools
This commit is contained in:
parent
5dcf0d6961
commit
d6ea5736a5
11 changed files with 20 additions and 25 deletions
|
|
@ -9,7 +9,7 @@ from datetime import date, datetime
|
|||
from hooks import hook
|
||||
from tools.countdown import countdown_format
|
||||
from tools.date import extractDate
|
||||
from xmlparser.node import ModuleState
|
||||
from tools.xmlparser.node import ModuleState
|
||||
|
||||
nemubotversion = 3.4
|
||||
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@
|
|||
from urllib.parse import quote
|
||||
from urllib.request import urlopen
|
||||
|
||||
import xmlparser
|
||||
from tools import web
|
||||
from tools.xmlparser import parse_string
|
||||
|
||||
class DDGSearch:
|
||||
def __init__(self, terms):
|
||||
self.terms = terms
|
||||
|
||||
raw = urlopen("https://api.duckduckgo.com/?q=%s&format=xml&no_redirect=1" % quote(terms), timeout=10)
|
||||
self.ddgres = xmlparser.parse_string(raw.read())
|
||||
self.ddgres = parse_string(raw.read())
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
from urllib.parse import quote
|
||||
from urllib.request import urlopen
|
||||
|
||||
import xmlparser
|
||||
from tools.xmlparser import parse_string
|
||||
|
||||
class WFASearch:
|
||||
def __init__(self, terms):
|
||||
|
|
@ -13,7 +13,7 @@ class WFASearch:
|
|||
"input=%s&appid=%s"
|
||||
% (quote(terms),
|
||||
CONF.getNode("wfaapi")["key"]), timeout=15)
|
||||
self.wfares = xmlparser.parse_string(raw.read())
|
||||
self.wfares = parse_string(raw.read())
|
||||
except (TypeError, KeyError):
|
||||
print ("You need a Wolfram|Alpha API key in order to use this "
|
||||
"module. Add it to the module configuration file:\n<wfaapi"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ nemubotversion = 3.4
|
|||
|
||||
from more import Response
|
||||
|
||||
import xmlparser
|
||||
|
||||
LANG = ["ar", "zh", "cz", "en", "fr", "gr", "it",
|
||||
"ja", "ko", "pl", "pt", "ro", "es", "tr"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue