Skip to content

Commit 9f3f4a9

Browse files
author
Zach Moody
authored
Merge pull request #359 from jqueuniet/fix_empty_list_conversion
Fix len() calls for empty RecordSet
2 parents dfccaba + be0f0d4 commit 9f3f4a9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pynetbox/core/response.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ def __len__(self):
8787
try:
8888
return self.request.count
8989
except AttributeError:
90-
self._response_cache.append(next(self.response))
90+
try:
91+
self._response_cache.append(next(self.response))
92+
except StopIteration:
93+
return 0
9194
return self.request.count
9295

9396

0 commit comments

Comments
 (0)