diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-04-11 16:05:26 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-04-11 16:05:26 +0700 |
| commit | a581095da416f586dd1bceba148cc1d0a4022976 (patch) | |
| tree | da71153e5ef1f01e4682a76b509a77f715540c58 | |
| parent | 3b5871b8c364e819a2fbaf268e4693e848e6af0a (diff) | |
add log while parsing ip address
| -rw-r--r-- | indoteknik_custom/models/ip_lookup.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/indoteknik_custom/models/ip_lookup.py b/indoteknik_custom/models/ip_lookup.py index 244982c0..9c4beda9 100644 --- a/indoteknik_custom/models/ip_lookup.py +++ b/indoteknik_custom/models/ip_lookup.py @@ -50,6 +50,7 @@ class IpLookup(models.Model): log.lookup = last_data.lookup country = json.loads(last_data.lookup)['country'] timezone = json.loads(last_data)['timezone'] + _logger.info('Parsing IP using last data %s' % log.id) else: ipinfo = requests.get('http://ip-api.com/json/%s' % log.ip_address).json() del ipinfo['status'] @@ -57,6 +58,7 @@ class IpLookup(models.Model): log.lookup = lookup_json country = json.loads(lookup_json)['country'] timezone = json.loads(lookup_json)['timezone'] + _logger.info('Parsing IP using API JSON %s' % log.id) log.country = country log.timezone = timezone log.continent = timezone.split('/')[0] |
