From 1579d35c362a5899f2a11fe7ab6b2875bb8fdc9b Mon Sep 17 00:00:00 2001 From: PAN Lei Date: Wed, 13 Mar 2024 23:08:07 +0100 Subject: [PATCH] add method to get ip information --- src/pojo/ip/ip_location.py | 10 ++++++++++ src/utils/contacts/generate_ip_with_contact.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/pojo/ip/ip_location.py diff --git a/src/pojo/ip/ip_location.py b/src/pojo/ip/ip_location.py new file mode 100644 index 0000000..99ec311 --- /dev/null +++ b/src/pojo/ip/ip_location.py @@ -0,0 +1,10 @@ +class IPLocationInfo: + + def __init__(self, ip, country, city, isp): + self.ip = ip + self.country = country + self.city = city + self.isp = isp + + def __repr__(self): + return "ip:{}, country:{}, city:{}, isp:{}".format(self.ip, self.country, self.city, self.isp) diff --git a/src/utils/contacts/generate_ip_with_contact.py b/src/utils/contacts/generate_ip_with_contact.py index 80f72bf..6eb1a5a 100644 --- a/src/utils/contacts/generate_ip_with_contact.py +++ b/src/utils/contacts/generate_ip_with_contact.py @@ -11,7 +11,7 @@ from src.pojo.ip.ip_location import IPLocationInfo def get_contact_list() -> list: - _successful_items = MONGO_STORE_MANAGER.get_all_successful_items_for_yesterday() + _successful_items = MONGO_STORE_MANAGER.get_all_successful_items_for_day() _contact_list = [] for item in _successful_items: if item.url_validated: