File tree Expand file tree Collapse file tree 2 files changed +3
-13
lines changed
Expand file tree Collapse file tree 2 files changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -346,17 +346,6 @@ def getBatchDetailsIter(
346346 else :
347347 lookup_addresses .append (ip_address )
348348
349- # pre-populate with anything we've got in the cache, and keep around
350- # the IPs not in the cache.
351- for ip_address in ip_addresses :
352- # if the supplied IP address uses the objects defined in the
353- # built-in module ipaddress extract the appropriate string notation
354- # before formatting the URL.
355- if isinstance (ip_address , IPv4Address ) or isinstance (
356- ip_address , IPv6Address
357- ):
358- ip_address = ip_address .exploded
359-
360349 try :
361350 cached_ipaddr = self .cache [cache_key (ip_address )]
362351 result [ip_address ] = cached_ipaddr
@@ -365,7 +354,7 @@ def getBatchDetailsIter(
365354
366355 # all in cache - exit early.
367356 if len (lookup_addresses ) == 0 :
368- yield result
357+ yield result . items ()
369358
370359 url = API_URL + "/batch"
371360 headers = handler_utils .get_headers (self .access_token , self .headers )
Original file line number Diff line number Diff line change @@ -358,7 +358,6 @@ async def getBatchDetailsIter(
358358 batch_size = BATCH_MAX_SIZE
359359
360360 results = {}
361-
362361 lookup_addresses = []
363362 for ip_address in ip_addresses :
364363 if isinstance (ip_address , IPv4Address ) or isinstance (
@@ -371,6 +370,8 @@ async def getBatchDetailsIter(
371370 details ["ip" ] = ip_address
372371 details ["bogon" ] = True
373372 yield Details (details )
373+ else :
374+ lookup_addresses .append (ip_address )
374375
375376 try :
376377 cached_ipaddr = self .cache [cache_key (ip_address )]
You can’t perform that action at this time.
0 commit comments