""" from __future__ import unicode_literals import re import sys import time import willie from willie.tools import Identifier, iteritems import base64 from willie.logger import get_logger if sys.version_info.major >= 3: unicode = str LOGGER = get_logger(__name__) def auth_after_register(bot): """Do NickServ/AuthServ auth""" if bot.config.core.auth_method == 'nickserv' or bot.config.core.nickserv_password: nickserv_name = bot.config.core.auth_target or bot.config.core.nickserv_name or 'NickServ' bot.msg( nickserv_name, 'IDENTIFY %s' % bot.config.core.nickserv_password ) elif bot.config.core.auth_method == 'authserv' or bot.config.core.authserv_password: account = bot.config.core.auth_username or bot.config.core.authserv_account password = bot.config.core.auth_password or bot.config.core.authserv_password bot.write((
urlretrieve = None try: from urllib import urlretrieve except ImportError: try: # urlretrieve has been put under urllib.request in Python 3. # It's also deprecated so this should probably be replaced with # urllib2. from urllib.request import urlretrieve except ImportError: pass from willie.module import commands, example from willie.logger import get_logger LOGGER = get_logger(__name__) def configure(config): """ | [ip] | example | purpose | | ---- | ------- | ------- | | GeoIP_db_path | None | Full path for the GeoIP database. If not specified or None, the bot will try to look for the database in /usr/share/GeoIP, and if it's not there it'll try to automatically download the database into its configuration directory | """ if config.option('Configure a custom location for the GeoIP db?', False): config.add_section('ip') config.interactive_add('ip', 'GeoIP_db_path', 'Full path to the GeoIP database', None) def _decompress(source, target, delete_after_decompression=True):
urlparse = urlparse.urlparse else: import urllib urlparse = urllib.parse.urlparse # an HTML tag. cargo-culted from etymology.py r_tag = re.compile(r'<[^>]+>') r_whitespace = re.compile(r'[\t\r\n ]+') api_url = None api_user = None api_key = None api_suffix = '/api/v1/' api_private = None log = logger.get_logger(__name__) def text(html): '''html to text dumb converter cargo-culted from etymology.py''' html = r_tag.sub('', html) html = r_whitespace.sub(' ', html) return web.decode(html.strip()) def configure(config): """ | [url] | example | purpose | | ---- | ------- | ------- |