Skip to content

Commit

Permalink
Handle empty parameters correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
elsif2 committed Mar 18, 2024
1 parent 42a9bfa commit d58dba0
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit d58dba0

Please sign in to comment.