add __init__.py for packaging, add some AAs

This commit is contained in:
Larry Kim 2013-02-08 01:21:39 +09:00
parent 8a6e99255a
commit 30016ba9c9
4 changed files with 30 additions and 7 deletions

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import sys, os
__version__ = '0.1'
@ -15,7 +16,8 @@ setup(name='whois',
author_email='admin@relip.org',
url='http://github.com/relip/python-whois',
license='MIT',
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
package_dir={'whois': 'src'},
packages=['whois'],
include_package_data=True,
zip_safe=False,
install_requires=[

11
src/__init__.py Normal file
View File

@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
# __ __ __ __ ______
#/\ \ /\ "-.\ \ /\ \ /\__ _\
#\ \ \\ \ \-. \\ \ \\/_/\ \/
# \ \_\\ \_\\"\_\\ \_\ \ \_\
# \/_/ \/_/ \/_/ \/_/ \/_/
from whois import *
from parser import *

View File

@ -1,5 +1,11 @@
# -*- coding: utf-8 -*-
# ______ ______ ______ ______ ______ ______
#/\ == \/\ __ \ /\ == \ /\ ___\ /\ ___\ /\ == \
#\ \ _-/\ \ __ \\ \ __< \ \___ \\ \ __\ \ \ __<
# \ \_\ \ \_\ \_\\ \_\ \_\\/\_____\\ \_____\\ \_\ \_\
# \/_/ \/_/\/_/ \/_/ /_/ \/_____/ \/_____/ \/_/ /_/
import error
import re

View File

@ -1,5 +1,11 @@
# -*- coding: utf-8 -*-
# __ __ __ __ ______ __ ______
#/\ \ _ \ \ /\ \_\ \ /\ __ \ /\ \ /\ ___\
#\ \ \/ ".\ \\ \ __ \\ \ \/\ \\ \ \\ \___ \
# \ \__/".~\_\\ \_\ \_\\ \_____\\ \_\\/\_____\
# \/_/ \/_/ \/_/\/_/ \/_____/ \/_/ \/_____/
import sys
import os
import socket
@ -31,7 +37,7 @@ class Whois(object):
else:
return self.tld + ".whois-servers.net"
def query(self, whoisServer):
def sendQuery(self, whoisServer):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
@ -55,19 +61,17 @@ class Whois(object):
return result
def run(self, redirect=True):
def query(self, redirect=True):
whoisServer = self.chooseServer()
result = self.query(whoisServer)
result = self.sendQuery(whoisServer)
if redirect and "redirect" in self.settings:
redirection = re.findall(self.settings["redirect"], result, re.MULTILINE)
while redirection and len(redirection) >= 1:
whoisServer = redirection[0]
result = self.query(whoisServer)
result = self.sendQuery(whoisServer)
redirection = re.findall(self.settings["redirect"], result)
return whoisServer, result