File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ def getBatchDetails(
218218 details = {}
219219 details ["ip" ] = ip_address
220220 details ["bogon" ] = True
221- return Details ( details )
221+ result [ ip_address ] = details
222222 else :
223223 lookup_addresses .append (ip_address )
224224
@@ -339,7 +339,7 @@ def getBatchDetailsIter(
339339 details = {}
340340 details ["ip" ] = ip_address
341341 details ["bogon" ] = True
342- yield Details ( details )
342+ result [ ip_address ] = details
343343 else :
344344 lookup_addresses .append (ip_address )
345345
@@ -351,7 +351,7 @@ def getBatchDetailsIter(
351351
352352 # all in cache - exit early.
353353 if len (lookup_addresses ) == 0 :
354- yield result .items ()
354+ raise StopIteration ( result .items () )
355355
356356 url = API_URL + "/batch"
357357 headers = handler_utils .get_headers (self .access_token , self .headers )
Original file line number Diff line number Diff line change @@ -196,5 +196,4 @@ def test_iterative_bogon_details():
196196 token = os .environ .get ("IPINFO_TOKEN" , "" )
197197 handler = Handler (token )
198198 details = next (handler .getBatchDetailsIter (["127.0.0.1" ]))
199- assert isinstance (details , Details )
200- assert details .all == {"bogon" : True , "ip" : "127.0.0.1" }
199+ assert details == {"bogon" : True , "ip" : "127.0.0.1" }
You can’t perform that action at this time.
0 commit comments