condition order fix
* fixed condition order to prevent NoneType errors * fixed readline to read
This commit is contained in:
parent
e9208a8277
commit
85ca549fab
10
main.py
10
main.py
|
@ -32,12 +32,12 @@ class BlacklistImporter:
|
||||||
head = s.head(self.url)
|
head = s.head(self.url)
|
||||||
etag = head.headers['etag']
|
etag = head.headers['etag']
|
||||||
|
|
||||||
# if file is present
|
# if etags match up or if a connection is not possible fall back to local cache
|
||||||
if os.path.isfile("blacklist.txt"):
|
if local_etag == etag or head.status_code != 200:
|
||||||
# if etags match up or if a connection is not possible fall back to local cache
|
# check if local cache is present
|
||||||
if local_etag == etag or head.status_code != 200:
|
if os.path.isfile("blacklist.txt"):
|
||||||
with open("blacklist.txt", "r", encoding="utf-8") as file:
|
with open("blacklist.txt", "r", encoding="utf-8") as file:
|
||||||
self.blacklist = file.readline()
|
self.blacklist = file.read()
|
||||||
|
|
||||||
# in any other case request a new file
|
# in any other case request a new file
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue