How to get WhoIs info by IP in Python 3?

Note: This is not a library recommendation question. It is rather about possible approaches to the problem. Question: What approaches are possible to retreive WhoIs information from given IP...

List Comprehension of IPWhois Module output

I am trying to pull out the data from a IPWhois lookup and put it into a list. I do not know the list comprehenion behind pulling out the nested list items in results2[7] from ipwhois import...

Error in ipaddr.py in Python

I'm trying to program an IP Lookup in python using the package "ipwhois". The problem is that when I try to execute it it gives me an error that I can not fix. I've already search in internet and...

How to parse text in python with IPWhois

My code is: from ipwhois import IPWhois import pprint obj = IPWhois('74.125.227.206') results = obj.lookup_rws() pprint.pprint(results) It returns: {'asn': '15169', 'asn_cidr':...

Trapping a custom error in python

I'm trying to trap the following error in a try/exception block, but as this is a custom module that is generating the error - not generating a standard error such as ValueError for example. What...

Should I block this Ip range?

There is a crawler on my site that does not identify as a robot in it's user agent. one of the ip addresses is: 131.161.8.197 All of the bots belong in the Ip range of 131.161. Apparently it is...

Add columns to each row of pandas dataframe

I have a Pandas dataframe (df) that has columns 'ip', 'country', 'city'. This data frame df has a lot of rows (~ 50,000) which is same as distinct IPs. I want to do a 'whois' lookup for each of...

"'NoneType' object is not subscriptable" OR "KeyError:" with openpyxl and ipwhois

I'm working on a python3 script that does the following: Open an excel file in the working directory Select the first sheet in the excel file Select all data in the third column (in this case a...

Python extract substring from string

so i'm trying to convert a bash script, that i wrote, into python, that i'm learning, and the python equivalent of the bash whois just can't give me the answer that i need. this is what i have in...

Getting the registrant address from a hostname?

I'm trying to get informations about some hostnames, for example the country of the registrant. I've found IPWhois who should do the job, but apparently it doesn't give me the expected data. For...

Why IPWhois in Python 2.7 can't get anwer?

I have installed python 2.7, IPWhois etc. I can get anwer to IP address: 74.125.225.229. But I can't get anwer for IP: 1.209.148.1. Can anyone help? Python 2.7.9 (default) [GCC 4.9.2] on...

formatting whois results to CSV using BASH and grep

I've been trying to get my head round this for a few hours now and thought I'd come here and ask for help. I have a CSV file of IP addresses from a log file that I want to run through and get a...

How to convert JSON object to markdown using pypandoc without writing to file?

I am trying to take a response from an API that reports back a JSON object and convert that to a markdown output to present it in a more readable format. I am attempting to use pypandoc to do this...

Running for loop in parallel via python

I have a process that loops over a list of IP addresses and returns some information about them. The simple for loop works great, my issue is running this at scale due to Python's Global...

NameError: name 'AF_INET' is not defined (ONLY ON MAC)

So I have python installed in three places: A Windows machine, a Pi (Running Kali), and my Mac. My Mac is the only one where I get this error when either importing the socket library or a library...

pandas dataframe apply function over column creating multiple columns

I have the pandas df below, with a few columns, one of which is ip_addresses df.head() my_id someother_id created_at ip_address state 308074 309115 2859690 ...

Python ipwhois ASN Registry Error

I am using ipwhois for the first time. Running the basic usage example with a Google IP address works: from ipwhois import IPWhois obj = IPWhois('74.125.225.229') results =...

Getting error parsing and displaying JSON object in ReactJS

I am attempting to parse and display a large JSON object on a dashboard I am creating and I think I am getting an error because of the way that I am formatting the javascript within my component....

Separate Key/Value pairs after parsing for styling

I have this code parsing a large JSON object into it's key/value pairs var origObject = {"id":3,"code":"\nfrom ipwhois import IPWhois\nimport json\nobj = IPWhois('104.24.114.36')\nresults =...

Ajax request to run a NodeJS function that runs a bash script

This bash script makes a JSON file that I will need to parse and send that data to the client side java script to display it. I am trying to do this without refreshing the page, I also don't...

Make button on website , which runs python script in ODOO

I've made a new module in odoo. It has the action button (check ip using ipwhois). Now i need to integrate this module in website. It is easy to show fields on webpage, but i don't know how make...

Bulk Whois lookup Of 20,000 domains - getting timeouts

Am trying to BULK extract WHOIS information for 20,000 domain names, the python code works with 2 items in my csv file but brings error with the whole dataset of 20000 domain names tried with 2...

How to fix urllib.error.HTTPError: HTTP Error 406: Not Acceptable

I'm using ipwhois PyPI, the code works to check the IP and gives the output but occasionally get an error: raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error...

Python os.system - set max time execution

I have a simple function which is aimed to parse IP and execute ipwhois on windows machine, printing output in serveral txt files: for ip in unique_ip: os.system('c:\whois64 -v ' + ip + '...

Issue with Importing IPwhois module

I'm trying to use IPwhois module. I installed it using PIP and when i try to import the module and use it in my script, it's giving below error: "ModuleNotFoundError: No module named...

Parse fields in Python ipwhois

I've created a script that uses a Python package, called IPWhois. IPWhois creates parsed data of IP whois records. Like this: {'asn': '13968', 'asn_cidr': '12.231.58.0/24', 'asn_country_code':...