Skip to content

Commit

Permalink
Improved documentation
Browse files Browse the repository at this point in the history
updated the docs and the setup script to the url of their location
  • Loading branch information
JustinAzoff committed Mar 22, 2009
1 parent 1cb6fc8 commit 27f66d3
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 14 deletions.
14 changes: 12 additions & 2 deletions cymruwhois.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/usr/bin/env python
# cymruwhois.py
# Copyright (C) 2009 Justin Azoff [email protected]
#
# This module is released under the MIT License:
# http://www.opensource.org/licenses/mit-license.php

import socket
import errno

Expand Down Expand Up @@ -145,8 +151,12 @@ def cache(self, r):
self.c.set(self.KEY_FMT % r.ip, r, 60*60*6)

def lookup(self, ip):
"""Look up a single address. This function should not be called in
loop, instead call lookupmany"""
"""Look up a single address.
.. warning::
Do not call this function inside of a loop, the performance
will be terrible. Instead, call lookupmany or lookupmany_dict
"""
return list(self.lookupmany([ip]))[0]

def lookupmany(self, ips):
Expand Down
12 changes: 12 additions & 0 deletions docs/about.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
About
=====

cymruwhois is a python library for interfacing with the whois.cymru.com service.

Get it
------
released versions are available for download at the `Python Package Index <http://pypi.python.org/pypi/cymruwhois/1.0>`_.

Source
------
The latest source code is avialable at the `githug project page <http://github.com/JustinAzoff/python-cymruwhois/tree/master>`_.
7 changes: 7 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
API
---

.. autoclass:: cymruwhois.Client
:members: lookup,lookupmany,lookupmany_dict
:undoc-members:

29 changes: 29 additions & 0 deletions docs/command_line.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Command-line Interface
======================
The cymruwhois utility program lets you do lookups from the command line or
shell scripts.

Lookups can be done from stdin or from files::

justin@dell ~ % cat /tmp/ips | cymruwhois
15169 66.102.1.104 66.102.0.0/23 US GOOGLE - Google Inc.
22990 169.226.1.110 169.226.0.0/16 US ALBANYEDU - The University at Albany
12306 82.98.86.176 82.98.64.0/18 DE PLUSLINE Plus.Line AG IP-Services

justin@dell ~ % cymruwhois /tmp/ips
15169 66.102.1.104 66.102.0.0/23 US GOOGLE - Google Inc.
22990 169.226.1.110 169.226.0.0/16 US ALBANYEDU - The University at Albany
12306 82.98.86.176 82.98.64.0/18 DE PLUSLINE Plus.Line AG IP-Services


The formatting of contents of the output can be controlled with the -f and -d options::

justin@dell ~ % cymruwhois /tmp/ips -f asn,cc
15169 US
22990 US
12306 DE

justin@dell ~ % cymruwhois /tmp/ips -f asn,cc -d,
15169,US
22990,US
12306,DE
14 changes: 3 additions & 11 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,9 @@ Contents:
.. toctree::
:maxdepth: 2

.. warning::
Do not call the Client.lookup function inside of a loop, the performance
will be terrible. Instead, call lookupmany or lookupmany_dict


Cymruwhois
----------

.. autoclass:: cymruwhois.Client
:members: lookup,lookupmany,lookupmany_dict
:undoc-members:
about
command_line
api


Indices and tables
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
""",

url="http://github.com/JustinAzoff/python-cymruwhois/tree/master",
url="http://packages.python.org/cymruwhois/",
download_url="http://github.com/JustinAzoff/python-cymruwhois/tree/master",
license='MIT',
classifiers=[
"Topic :: System :: Networking",
"Environment :: Console",
Expand Down

0 comments on commit 27f66d3

Please sign in to comment.