diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2013-05-09 21:47:45 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2013-05-09 21:47:45 +0200 |
commit | 365044f55afc191bcbc7ee16c445ef593a4b24c2 (patch) | |
tree | 3a4d08bc50fee5711cf2d47f207000a71237521e /modules | |
parent | 87daa6075ffa7dc9b583e13702dd10270f3a0834 (diff) |
Sanified some module imports.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/anidb.py | 6 | ||||
-rw-r--r-- | modules/google_search.py | 4 | ||||
-rw-r--r-- | modules/quotes.py | 4 | ||||
-rw-r--r-- | modules/tracking.py | 6 | ||||
-rw-r--r-- | modules/traffic.py | 2 | ||||
-rw-r--r-- | modules/tvrage.py | 2 | ||||
-rw-r--r-- | modules/wolframalpha.py | 2 |
7 files changed, 13 insertions, 13 deletions
diff --git a/modules/anidb.py b/modules/anidb.py index bae2191..2b8f6e3 100644 --- a/modules/anidb.py +++ b/modules/anidb.py @@ -5,8 +5,8 @@ info = { } import urllib2, gzip, os, time -from pyPgSQL import PgSQL -from lxml import etree +import psycopg2 +from xml import etree import pyanidb import ConfigParser import marshal @@ -20,7 +20,7 @@ for option in ('username', 'password'): class Module: def __init__(self, bot): self.irc = bot - self.db = PgSQL.connect(database = 'fot') + self.db = psycopg2.connect(database = 'fot') if self.irc: self.irc.register_keyword('!anidb', self) diff --git a/modules/google_search.py b/modules/google_search.py index 8af2c62..1bd0f26 100644 --- a/modules/google_search.py +++ b/modules/google_search.py @@ -4,7 +4,7 @@ info = { 'description': 'Google Search', } -import urllib, urllib2, simplejson +import urllib, urllib2, json class Module: def __init__(self, bot): @@ -19,7 +19,7 @@ class Module: print 'error', e, str(e) raise - data = simplejson.loads(u.read()) + data = json.loads(u.read()) response = data['responseData'] if not data['responseStatus'] == 200 or not len(response['results']): return diff --git a/modules/quotes.py b/modules/quotes.py index bea34e3..b648d7b 100644 --- a/modules/quotes.py +++ b/modules/quotes.py @@ -5,7 +5,7 @@ info = { } import random, time, re -from pyPgSQL import PgSQL +import psycopg2 class Quotes: def __init__(self, db = None): @@ -16,7 +16,7 @@ class Quotes: return q def connect(self, db): - self.db = PgSQL.connect(database = 'fot') + self.db = psycopg2.connect(database = 'fot') self.updatecount() def updatecount(self): diff --git a/modules/tracking.py b/modules/tracking.py index 12fcffa..1d84fce 100644 --- a/modules/tracking.py +++ b/modules/tracking.py @@ -7,7 +7,7 @@ info = { cfg_section = 'module/tracking' import urllib2, datetime, re -from lxml import etree +from xml.etree import ElementTree as ET from twisted.internet import reactor from twisted.internet.task import LoopingCall from sqlalchemy import create_engine, Column, Integer, String, DateTime, ForeignKey @@ -110,7 +110,7 @@ class PostenModule(TrackingModule): except Exception as e: raise PackageError(str(e)) if u.headers['content-type'].startswith('application/xml'): - xml = etree.parse(u) + xml = ET.parse(u) else: xml = None u.close() @@ -128,7 +128,7 @@ class PostenModule(TrackingModule): return ns = 'http://www.bring.no/sporing/1.0' - packages = xml.find('//{%s}PackageSet' % (ns,)) + packages = xml.find('.//{%s}PackageSet' % (ns,)) if packages is None: raise NoPackageFound('No packages found for \002%s\002.' % code) diff --git a/modules/traffic.py b/modules/traffic.py index 76e8cc8..a844b45 100644 --- a/modules/traffic.py +++ b/modules/traffic.py @@ -7,7 +7,7 @@ info = { } import urllib2, urllib -from lxml import etree +from xml import etree counties = { 'Akershus': 2, diff --git a/modules/tvrage.py b/modules/tvrage.py index 02675cb..d500d96 100644 --- a/modules/tvrage.py +++ b/modules/tvrage.py @@ -5,7 +5,7 @@ info = { } import urllib, urllib2, datetime, rfc3339, pytz -from lxml import etree +from xml import etree class Module: def __init__(self, bot): diff --git a/modules/wolframalpha.py b/modules/wolframalpha.py index 8a752be..6fccb6a 100644 --- a/modules/wolframalpha.py +++ b/modules/wolframalpha.py @@ -5,7 +5,7 @@ info = { } import urllib, urllib2, re -from lxml.etree import ElementTree +from xml.etree import ElementTree whitespace_re = re.compile(r'\s+') |