diff --git a/setup.py b/setup.py index d9637b9..9242325 100644 --- a/setup.py +++ b/setup.py @@ -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=[ diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e0c974c --- /dev/null +++ b/src/__init__.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- + +# __ __ __ __ ______ +#/\ \ /\ "-.\ \ /\ \ /\__ _\ +#\ \ \\ \ \-. \\ \ \\/_/\ \/ +# \ \_\\ \_\\"\_\\ \_\ \ \_\ +# \/_/ \/_/ \/_/ \/_/ \/_/ + +from whois import * +from parser import * + diff --git a/src/parser.py b/src/parser.py index 1b756c7..7a2ee22 100644 --- a/src/parser.py +++ b/src/parser.py @@ -1,5 +1,11 @@ # -*- coding: utf-8 -*- +# ______ ______ ______ ______ ______ ______ +#/\ == \/\ __ \ /\ == \ /\ ___\ /\ ___\ /\ == \ +#\ \ _-/\ \ __ \\ \ __< \ \___ \\ \ __\ \ \ __< +# \ \_\ \ \_\ \_\\ \_\ \_\\/\_____\\ \_____\\ \_\ \_\ +# \/_/ \/_/\/_/ \/_/ /_/ \/_____/ \/_____/ \/_/ /_/ + import error import re diff --git a/src/whois.py b/src/whois.py index bf2e630..c66c169 100644 --- a/src/whois.py +++ b/src/whois.py @@ -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 - -