Skip to content

Commit d58dba0

Browse files
committed
Handle empty parameters correctly.
1 parent 42a9bfa commit d58dba0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

intelmq/bots/collectors/shadowserver/collector_reports_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ class ShadowServerAPICollectorBot(CollectorBot, HttpMixin, CacheMixin):
5050
_report_list = []
5151

5252
def init(self):
53-
if self.api_key is None:
53+
if not self.api_key:
5454
raise ValueError('No api_key provided.')
55-
if self.secret is None:
55+
if not self.secret:
5656
raise ValueError('No secret provided.')
5757

5858
if isinstance(self.reports, str):
5959
self._report_list = self.reports.split(',')
6060
elif isinstance(self.reports, list):
6161
self._report_list = self.reports
6262

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

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

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

115115
return reports

0 commit comments

Comments
 (0)