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

Handle empty parameters correctly. #2481

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
8 changes: 4 additions & 4 deletions intelmq/bots/collectors/shadowserver/collector_reports_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ class ShadowServerAPICollectorBot(CollectorBot, HttpMixin, CacheMixin):
_report_list = []

def init(self):
if self.api_key is None:
if not self.api_key:
raise ValueError('No api_key provided.')
if self.secret is None:
if not self.secret:
raise ValueError('No secret provided.')

if isinstance(self.reports, str):
self._report_list = self.reports.split(',')
elif isinstance(self.reports, list):
self._report_list = self.reports

if self.country is not None and self.country not in self._report_list:
if self.country and self.country not in self._report_list:
self.logger.warn("Deprecated parameter 'country' found. Please use 'reports' instead. The backwards-compatibility will be removed in IntelMQ version 4.0.0.")
self._report_list.append(self.country)

Expand Down Expand Up @@ -109,7 +109,7 @@ def _reports_list(self, date=None):
self.logger.debug('There was an error downloading the reports: %s', reports['error'])
return None

if self.types is not None:
if self.types:
reports = [report for report in reports if any(rtype in report['file'] for rtype in self.types)]

return reports
Expand Down
Loading