How do I identify the user type of an IP address? Using python and requests/bs4/flask
Question: I'm using python with requests/bs4/flask and I'd like to identify the user
type of an incoming IP request to my flask app.

<http://ipleak.net> identifies the type as residential, college, cafe,
corporate, ect but they only check your IP.

[GeoIP2](https://www.maxmind.com/en/geoip2-precision-insights) is the API that
drives ipleak.net for this and the returned parameter is called User Type.

How do I identify an IP type without using their API? I'm okay with less
accuracy/classification. Is there a public API for this? Or can I scrape it
from a whois DB? Or can I identify it in another way?


Answer: I monitored the network traffic and found the call to check the type of IP. I
wrote this function to check any IP that I pass to the function.

    
    
      import requests
      from bs4 import BeautifulSoup
    
      # check type of IP address
      def ip_check(ip):
            result = requests.get('https://ipleak.net/?mode=ajax&ip={}'.format(ip))
            soup = BeautifulSoup(result.text, 'html.parser')
            parse = soup.get_text()
            final = parse.replace('\xa0', '').replace(ip, '')
            return final
    

