mirror of https://github.com/CIRCL/lookyloo
fix: Avoid exception on non-empty directory
parent
884b5cf488
commit
52076925b8
|
@ -105,6 +105,11 @@ class RiskIQ():
|
||||||
|
|
||||||
pdns_info = self.client_dns.get_passive_dns(query=hostname, start=first_seen.isoformat())
|
pdns_info = self.client_dns.get_passive_dns(query=hostname, start=first_seen.isoformat())
|
||||||
if not pdns_info:
|
if not pdns_info:
|
||||||
|
try:
|
||||||
|
url_storage_dir.rmdir()
|
||||||
|
except OSError:
|
||||||
|
# Not empty.
|
||||||
|
pass
|
||||||
return
|
return
|
||||||
pdns_info['results'] = sorted(pdns_info['results'], key=lambda k: k['lastSeen'], reverse=True)
|
pdns_info['results'] = sorted(pdns_info['results'], key=lambda k: k['lastSeen'], reverse=True)
|
||||||
with riskiq_file.open('w') as _f:
|
with riskiq_file.open('w') as _f:
|
||||||
|
|
|
@ -79,7 +79,11 @@ class URLhaus():
|
||||||
if (not url_information
|
if (not url_information
|
||||||
or ('query_status' in url_information
|
or ('query_status' in url_information
|
||||||
and url_information['query_status'] == 'no_results')):
|
and url_information['query_status'] == 'no_results')):
|
||||||
url_storage_dir.rmdir()
|
try:
|
||||||
|
url_storage_dir.rmdir()
|
||||||
|
except OSError:
|
||||||
|
# Not empty.
|
||||||
|
pass
|
||||||
return
|
return
|
||||||
|
|
||||||
with uh_file.open('w') as _f:
|
with uh_file.open('w') as _f:
|
||||||
|
|
Loading…
Reference in New Issue