[Tutor] whois github package

Alan Gauld alan.gauld at btinternet.com
Sun Apr 26 01:25:59 CEST 2015


On 25/04/15 14:46, Juanald Reagan wrote:
> Hello! I have a question regarding how to use/implement a package found at
> github.
>
> https://github.com/secynic/ipwhois


We are not experts on this here since this list s for people learning 
the core Python lamguage and its standard library. Howe er I see Steven 
has had a go at helping you.

Another thing you could try is using Pythons built in help() function:

After
>>> from ipwhois import IPWhois

Try
 >>> help(IPWhois)

>      obj = IPWhois(ipaddy)

Now try

 >>> help(obj)
 >>> help(obj.lookup)

That might give some clues about what methods exist and what they 
return. (Assuming the author included doc strings of course!

>      results = [obj.lookup()]
>      print results [0]
>
> This returns ALL the fields not just the "asn_registry" field.

That's what I'd expect since you put the output of lookup()
as the first element of the list. You then printed that element.

But if you showed us even a snippet of what that actually
looked like it would help us answer your question about
how to access it. Remember we don't know this package so
you have to show us what is happening not just summarize
what you think its doing.

 > I looked for documentation on github

Python documentation is often embedded in the module/objects
help() will often reveal it.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list