Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shadowserver: Fix parameter 'reports' behaviour if empty string #2523

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions intelmq/bots/collectors/shadowserver/collector_reports_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ShadowServerAPICollectorBot(CollectorBot, HttpMixin, CacheMixin):
Parameters:
api_key (str): Your Shadowserver API key
secret (str): Your Shadowserver API secret
country (str): DEPRECIATED The mailing list you want to download reports for (i.e. 'austria')
country (str): DEPRECATED The mailing list you want to download reports for (i.e. 'austria')
reports (list):
A list of strings or a comma-separated list of the mailing lists you want to process.
types (list):
Expand All @@ -56,7 +56,9 @@ def init(self):
raise ValueError('No secret provided.')

if isinstance(self.reports, str):
self._report_list = self.reports.split(',')
# if reports is an empty string (or only contains whitespace), behave as if the parameter is not set and select all reports
reports = self.reports.strip()
self._report_list = reports.split(',') if reports else []
elif isinstance(self.reports, list):
self._report_list = self.reports
if isinstance(self.types, str):
Expand Down
Loading