Skip to content

Commit 6152227

Browse files
author
github-actions
committed
don't retry 404s
1 parent 262376b commit 6152227

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

bbot/modules/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,8 @@ def _prepare_api_iter_req(self, url, page, page_size, offset, **requests_kwargs)
12031203
return url, requests_kwargs
12041204

12051205
def _api_response_is_success(self, r):
1206-
return r.is_success
1206+
# 404s typically indicate no data rather than an actual error with the API, so we don't want to retry them
1207+
return getattr(r, "is_success", False) and not getattr(r, "status_code", 0) == 404
12071208

12081209
async def api_page_iter(self, url, page_size=100, _json=True, next_key=None, iter_key=None, **requests_kwargs):
12091210
"""

bbot/modules/shodan_idb.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ async def setup(self):
6969
def _incoming_dedup_hash(self, event):
7070
return hash(self.get_ip(event))
7171

72-
def _api_response_is_success(self, r):
73-
# 404s are normal, so we don't want to retry them
74-
return r.is_success and not getattr(r, "status_code", 0) == 404
75-
7672
@property
7773
def api_retries(self):
7874
# allow the module to override global retry setting

0 commit comments

Comments
 (0)