[Tutor] whois github package
Hello! I have a question regarding how to use/implement a package found at github. https://github.com/secynic/ipwhois I am able to run the sample code without any issues but what I don't understand is how to put all the data that is returned into an indexed list. I want to be able to pick out some of the returned data through an index. For example: from ipwhois import IPWhois obj = IPWhois(ipaddy) results = [obj.lookup()] print results [0] This returns ALL the fields not just the "asn_registry" field. I looked for documentation on github but did not see anything. Any thoughts/comments are appreciated, thanks! -- Cheers, Jon ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tutor Digest, Vol 134, Issue 86
Okay, so it doesn't look like that worked...here is the traceback. I don't understand the second part of your request. Jons-desktop:whois-0.7 2 jon$ python pythonwhois.py 8.8.8.8 Traceback (most recent call last): File "pythonwhois.py", line 14, in print results.asn_registry AttributeError: 'dict' object has no attribute 'asn_registry' On Sat, Apr 25, 2015 at 11:30 AM, wrote: > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body 'help' to > tutor-requ...@python.org > > You can reach the person managing the list at > tutor-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Tutor digest..." > > > Today's Topics: > >1. Re: name shortening in a csv module output (Steven D'Aprano) >2. Re: sig no matter what (eryksun) >3. whois github package (Juanald Reagan) >4. Re: whois github package (Steven D'Aprano) >5. Questions (and initial responses) on using version control > [Was: Introductory questions on test-driven development and > implementing Git version control.] (boB Stepp) > > > -- > > Message: 1 > Date: Sat, 25 Apr 2015 21:27:55 +1000 > From: Steven D'Aprano > To: tutor@python.org > Subject: Re: [Tutor] name shortening in a csv module output > Message-ID: <20150425112751.gf5...@ando.pearwood.info> > Content-Type: text/plain; charset=us-ascii > > On Fri, Apr 24, 2015 at 01:04:57PM +0200, Laura Creighton wrote: > > In a message of Fri, 24 Apr 2015 12:46:20 +1000, "Steven D'Aprano" > writes: > > >The Japanese, Chinese and Korean > > >governments, as well as linguists, are all in agreement that despite a > > >few minor differences, the three languages share a common character set. > > > > I don't think that is quite the way to say it. There are characters, > > which look exactly the same in all three languages, and the linguists > > are mostly in agreement that the reason they look the same is that the > > are the same. > > > > But it is more usual to write Korean, these days, not with Chinese > > characters, (hanja) but with hangul. In the 15th century, the King, > > Sejong the great decided that Koreans needed a phoenetic alphabet, and > > made one. It doesn't look anything like chinese. And it is a phonetic, > > alphabetic langauge, not a stroke-and-character one. > > Thanks for the correction Laura, I didn't know that Korean has two > separate writing systems. But I did know that Japanese has at least two, > one based on Chinese characters and the other not, and that Chinese > itself has traditional and simplified versions of their characters. > Beyond that, it's all Greek to me :-) > > > -- > Steve > > > -- > > Message: 2 > Date: Sat, 25 Apr 2015 07:48:06 -0500 > From: eryksun > To: "tutor@python.org" > Subject: Re: [Tutor] sig no matter what > Message-ID: > < > cacl+1at+xgqj0tdny0k4jzz7ae4nh7nqfruvrf-qehmyta2...@mail.gmail.com> > Content-Type: text/plain; charset=UTF-8 > > On Fri, Apr 24, 2015 at 10:46 PM, Jim Mooney > wrote: > > The docs don't mention that case is immaterial for aliases, when it > usually > > matters in Python. > > Section 7.2.3: > > Notice that spelling alternatives that only differ in case or use a > hyphen > instead of an underscore are also valid aliases > > > So of course my favorite is u8 - less typing, and ubom for decoding if I > get > > those funny bytes ;') > > Less typing, yes, but also less self-documenting. > > > -- > > Message: 3 > Date: Sat, 25 Apr 2015 09:46:26 -0400 > From: Juanald Reagan > To: "tutor@python.org" > Subject: [Tutor] whois github package > Message-ID: > 6gu2doxq2c8kckyb8qq9jcpmuzt9_vu+7x8v9t...@mail.gmail.com> > Content-Type: text/plain; charset=UTF-8 > > Hello! I have a question regarding how to use/implement a package found at > github. > > https://github.com/secynic/ipwhois > > I am able to run the sample code without any issues but what I don't > understand is how to put all the data that is returned into an indexed > list. I want to be able to pick out some of the returned data through an > index. > > For exam
Re: [Tutor] Tutor Digest, Vol 134, Issue 89
RWS service yet. We have | to rely on the Ripe RWS service, which does not contain all of the | data we need. LACNIC RWS is in beta v2. | | Args: | inc_raw: Boolean for whether to include the raw whois results in | the returned dictionary. | retry_count: The number of times to retry in case socket errors, | timeouts, connection resets, etc. are encountered. | | Returns: | Dictionary: A dictionary containing the following keys: | query (String) - The IP address. | asn (String) - The Autonomous System Number. | asn_date (String) - The ASN Allocation date. | asn_registry (String) - The assigned ASN registry. | asn_cidr (String) - The assigned ASN CIDR. | asn_country_code (String) - The assigned ASN country code. | nets (List) - Dictionaries containing network information | which consists of the fields listed in the NIC_WHOIS | dictionary. Certain IPs have more granular network | listings, hence the need for a list object. | raw (Dictionary) - Whois results in Json format if the | inc_raw parameter is True. On Sat, Apr 25, 2015 at 8:43 PM, wrote: > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body 'help' to > tutor-requ...@python.org > > You can reach the person managing the list at > tutor-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Tutor digest..." > > > Today's Topics: > >1. Re: whois github package (Alan Gauld) >2. Looking up a value in a dictionary (Danny Yoo) >3. REPL format (Jim Mooney) >4. Re: REPL format (Danny Yoo) >5. Re: REPL format (Danny Yoo) >6. Re: REPL format (Alan Gauld) > > > -- > > Message: 1 > Date: Sun, 26 Apr 2015 00:25:59 +0100 > From: Alan Gauld > To: tutor@python.org > Subject: Re: [Tutor] whois github package > Message-ID: > Content-Type: text/plain; charset=windows-1252; format=flowed > > 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 > > > > > -- > > Message: 2 > Date: Sat, 25 Apr 2015 16:38:15 -0700 > From: Danny Yoo > To: Juanald Reagan > Cc: "tutor@python.org" > Subject: [Tutor] Looking up a value in a dictionary > Message-ID: > < > cagzapf4vbgqrsvvkfrtpaylxh8pcm85zydldwsreudazpxd...@mail.gmail.com> > Content-Type: text/plain; charset=UTF-8 > > On Sat, Apr 25, 2015 at 11:13 AM, Juanald Reagan > wrote: > > Okay, so it doesn't look like that worked...here is the t
[Tutor] pip install M2crypto
Good Evening, I am trying to install the M2crypto package via pip and receive an error. Python version is 2.7.4, any ideas on how to fix the SWIG error? Jon$ sudo -H pip install M2crypto /Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning . InsecurePlatformWarning Collecting M2crypto /Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning . InsecurePlatformWarning Downloading M2Crypto-0.22.3.tar.gz (74kB) 100% || 77kB 784kB/s Installing collected packages: M2crypto Running setup.py install for M2crypto Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-covxwD/M2crypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-NWsSZ5-record/install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build/lib.macosx-10.10-intel-2.7 creating build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/__init__.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/ASN1.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/AuthCookie.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/BIO.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/BN.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/callback.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/DH.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/DSA.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/EC.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/Engine.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/Err.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/EVP.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/ftpslib.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/httpslib.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/m2.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/m2urllib.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/m2urllib2.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/m2xmlrpclib.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/Rand.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/RC4.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/RSA.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/SMIME.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/threading.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/util.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto copying M2Crypto/X509.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto creating build/lib.macosx-10.10-intel-2.7/M2Crypto/SSL copying M2Crypto/SSL/__init__.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto/SSL copying M2Crypto/SSL/cb.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto/SSL copying M2Crypto/SSL/Checker.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto/SSL copying M2Crypto/SSL/Cipher.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto/SSL copying M2Crypto/SSL/Connection.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto/SSL copying M2Crypto/SSL/Context.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto/SSL copying M2Crypto/SSL/Session.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto/SSL copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto/SSL copying M2Crypto/SSL/SSLServer.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto/SSL copying M2Crypto/SSL/timeout.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto/SSL copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.macosx-10.10-intel-2.7/M2Crypto/SSL running build_ext building 'M2Crypto.__m2crypto' extension swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c swig -python -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/include -I/usr/include/openssl -includeall -modern -o SWIG/_m2crypto_wr