[wip] in modules, changes import to reflect new directory structure

This commit is contained in:
nemunaire 2015-01-03 20:34:44 +01:00
commit 7c7b63634b
39 changed files with 87 additions and 86 deletions

View file

@ -2,7 +2,7 @@
"""Various network tools (w3m, w3c validator, curl, traceurl, ...)"""
from hooks import hook
from nemubot.hooks import hook
nemubotversion = 3.4

View file

@ -1,6 +1,6 @@
import urllib
from tools.web import getJSON
from nemubot.tools.web import getJSON
def isup(url):
"""Determine if the given URL is up or not

View file

@ -4,8 +4,8 @@ import subprocess
import tempfile
import urllib
from bot import __version__
from tools import web
from nemubot import __version__
from nemubot.tools import web
def load(CONF, add_hook):

View file

@ -1,6 +1,8 @@
import json
import urllib
from nemubot import __version__
def validator(url):
"""Run the w3c validator on the given URL
@ -15,7 +17,7 @@ def validator(url):
raise IRCException("Indiquer une URL valide !")
try:
req = urllib.request.Request("http://validator.w3.org/check?uri=%s&output=json" % (urllib.parse.quote(o.geturl())), headers={ 'User-Agent' : "nemubot v3" })
req = urllib.request.Request("http://validator.w3.org/check?uri=%s&output=json" % (urllib.parse.quote(o.geturl())), headers={ 'User-Agent' : "Nemubot v%s" % __version__})
raw = urllib.request.urlopen(req, timeout=10)
except urllib.error.HTTPError as e:
raise IRCException("HTTP error occurs: %s %s" % (e.code, e.reason))

View file

@ -4,12 +4,13 @@ from random import randint
import urllib.parse
from urllib.parse import urlparse
from hooks import hook
from more import Response
from tools.xmlparser.node import ModuleState
from nemubot.hooks import hook
from nemubot.tools.xmlparser.node import ModuleState
nemubotversion = 3.4
from more import Response
from .atom import Atom
from . import page

View file

@ -1,8 +1,9 @@
import datetime
import urllib
from nemubot.tools.web import getJSON
from more import Response
from tools.web import getJSON
URL_WHOIS = "http://www.whoisxmlapi.com/whoisserver/WhoisService?rid=1&domainName=%%s&outputFormat=json&userName=%s&password=%s"
@ -17,7 +18,7 @@ def load(CONF, add_hook):
else:
URL_WHOIS = URL_WHOIS % (urllib.parse.quote(CONF.getNode("whoisxmlapi")["username"]), urllib.parse.quote(CONF.getNode("whoisxmlapi")["password"]))
from hooks.messagehook import MessageHook
from nemubot.hooks.messagehook import MessageHook
add_hook("cmd_hook", MessageHook(cmd_whois, "netwhois"))