aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornico <nico@magicbroccoli.de>2019-02-15 19:39:27 +0100
committernico <nico@magicbroccoli.de>2019-02-15 19:39:27 +0100
commit85ca549fabf298dd87ae34b4779604bad8efbe5b (patch)
tree8a64c88e824c3232527547fbd1c9b4cb1b22101b
parente9208a82770ca23bf74ec52f64402420fe03ecf5 (diff)
condition order fix
* fixed condition order to prevent NoneType errors * fixed readline to read
-rw-r--r--main.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/main.py b/main.py
index ae5f562..c9deb83 100644
--- a/main.py
+++ b/main.py
@@ -32,12 +32,12 @@ class BlacklistImporter:
head = s.head(self.url)
etag = head.headers['etag']
- # if file is present
- if os.path.isfile("blacklist.txt"):
- # if etags match up or if a connection is not possible fall back to local cache
- 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
+ if local_etag == etag or head.status_code != 200:
+ # check if local cache is present
+ if os.path.isfile("blacklist.txt"):
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
else: