Move xmlparser to tools

This commit is contained in:
nemunaire 2014-12-06 09:00:53 +01:00
commit d6ea5736a5
11 changed files with 20 additions and 25 deletions

View file

@ -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

View file

@ -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):

View file

@ -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"

View file

@ -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"]