From 03f5d172734556213b67db1487c0d2dc552477ff Mon Sep 17 00:00:00 2001 From: AndrewCopeland Date: Fri, 22 Mar 2024 22:55:39 -0400 Subject: [PATCH] Better description fix type for bulk --- README.md | 17 +++++++++++++---- ipdetective.py | 2 +- setup.py | 12 +++++++++--- test.py | 9 +++++++-- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f9bf4f0..345d70e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # IPDetective Client -IPDetective is an API that focuses on bot and non-human IP detection to quickly identify if an IP address comes from a datacenter, VPN or proxy. You can signup to the free API by simply signing in to access your API key. IPDetective tracks over 1000 ASNs and detects over 250 million IP addresses as non-human users from +100 different origins, ranging from data centers, botnets, proxies and vpns. +[IPDetective](https://ipdetective.io) is an API that focuses on bot and non-human IP detection to quickly identify if an IP address comes from a datacenter, VPN or proxy. You can signup to the free API by simply signing in to access your API key. IPDetective tracks over 1000 ASNs and detects over 250 million IP addresses as non-human users from +100 different origins, ranging from data centers, botnets, proxies and vpns. ## Features - IP Bot Detection @@ -14,10 +14,19 @@ from ipdetective import IPDetective def main(): api_key = os.getenv('IPDETECTIVE_API_KEY') ip_client = IPDetective(api_key) - ip_address = '8.8.8.8' - ip_info = ip_client.GetIpInfo(ip_address) + + # Get information about a singular IP address + ip_info = ip_client.GetIpInfo('8.8.8.8') print(ip_info) + # {'ip': '8.8.8.8', 'bot': True, 'type': 'bot', 'asn': 15169, 'asn_description': 'GOOGLE', 'country_code': 'US', 'country_name': 'United States of America'} + + # Get information about build IP addresses + bulk_ip_info = ip_client.GetBulkIpInfo(['8.8.8.8', '1.1.1.1']) + print(bulk_ip_info) + # [{'ip': '1.1.1.1', 'bot': True, 'type': 'bot', 'asn': 13335, 'asn_description': 'CLOUDFLARENET', 'country_code': 'US', 'country_name': 'United States of America'}, {'ip': '8.8.8.8', 'bot': True, 'type': 'bot', 'asn': 15169, 'asn_description': 'GOOGLE', 'country_code': 'US', 'country_name': 'United States of America'}] if __name__ == "__main__": main() -``` \ No newline at end of file +``` + +[Check out our website](https://ipdetective.io) \ No newline at end of file diff --git a/ipdetective.py b/ipdetective.py index 7324878..50fd886 100644 --- a/ipdetective.py +++ b/ipdetective.py @@ -13,7 +13,7 @@ def GetIpInfo(self, ip_address): return {"error": "Internal server error occured"} return response.json() - def GetBuilkIpInfo(self, ip_addresses): + def GetBulkIpInfo(self, ip_addresses): headers = {'x-api-key': self.api_key} url = f"{self.base_url}?info=true" response = requests.post(url, headers=headers, json=ip_addresses) diff --git a/setup.py b/setup.py index 2b5be39..73c8245 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,19 @@ from setuptools import setup, find_packages +from pathlib import Path +this_directory = Path(__file__).parent +long_description = (this_directory / "README.md").read_text() setup( name='ipdetective', - version='1.0.0', + version='1.0.1', description='A Python client for IPDetective API', - long_description='''This package provides a Python client for retrieving bot and geolocation information for IP addresses using the IPDetective API. It allows users to query various details such as the country code, country name, ASN (Autonomous System Number), and IP Address classification like VPN, Proxy, Datacenter and Bot''', + long_description=long_description, author='IPDetective', author_email='andrew@ipdetective.io', - url='https://github.com/AndrewCopeland/ipdetective-client-python', + project_urls={ + 'Homepage': 'https://ipdetective.io', + 'Source': 'https://github.com/AndrewCopeland/ipdetective-client-python' + }, packages=find_packages(), install_requires=['requests'], classifiers=[ diff --git a/test.py b/test.py index 45fe9bd..92a6e6d 100644 --- a/test.py +++ b/test.py @@ -4,9 +4,14 @@ def main(): api_key = os.getenv('IPDETECTIVE_API_KEY') ip_client = IPDetective(api_key) - ip_address = '8.8.8.8' - ip_info = ip_client.GetIpInfo(ip_address) + + # Get information about a singular IP address + ip_info = ip_client.GetIpInfo('8.8.8.8') print(ip_info) + # Get information about build IP addresses + bulk_ip_info = ip_client.GetBulkIpInfo(['8.8.8.8', '1.1.1.1']) + print(bulk_ip_info) + if __name__ == "__main__": main() \ No newline at end of file