Skip to content

Commit ebb51b4

Browse files
committed
Fixed an output bug (regex)
- updated regex for diff outputs which had commas in them - updated and catching ConnectionException.
1 parent 22de8ff commit ebb51b4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

checker.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ def get_webpage(self) -> str:
7373
while True:
7474
try: # if electricity goes out, and internet is not available for the time
7575
html_page = requests.get(self.get_url(), verify=self.verifySSL).text
76-
except ConnectionError:
77-
self.logger.critical("ConnectionError! Internet or Electricity has probably gone out for a while. "
78-
"Retrying in 1minute...")
79-
sleep(60)
80-
continue
8176
except requests.exceptions.SSLError as error:
8277
print(error)
8378
self.logger.critical("Looks like, requests is having problems with SSL for this website.\n"
8479
"Try adding 'false' in the 4th column in csv file for this webpage"
8580
"(Refer \"README How To Run\" 1st bullet point)")
8681
# TODO: skip the current wbsite instead of quitting program.
8782
quit()
83+
except requests.exceptions.ConnectionError:
84+
self.logger.critical("ConnectionError! Internet or Electricity has probably gone out for a while. "
85+
"Retrying in 1minute...")
86+
sleep(60)
87+
continue
8888

8989
if len(html_page) == 0:
9090
self.logger.warning(f" received webpage for \"{self.get_name()}\" of size 0! Retrying... ")
@@ -146,7 +146,7 @@ def set_verifySSL(self, value: str):
146146
self.verifySSL = False
147147
self.logger.warning("SSL verification has been disabled for this website.")
148148
else:
149-
self.verifySSL = value
149+
self.verifySSL = True
150150

151151
# ==========================================
152152
## Other Functions
@@ -330,7 +330,7 @@ def filter_DiffOutput(output):
330330
:param output: the output received from diff command
331331
:return: list, a list of both code files. eg: [(code1, code2), (code1, code2)]
332332
"""
333-
line_regex = re.compile(r'^\d+c\d+|\n\d+c\d+') # Regex to match 634c634 stuff to split the output
333+
line_regex = re.compile(r'^\d+(?:,\d+)?c\d+(?:,\d+)?|\n\d+(?:,\d+)?c\d+(?:,\d+)?') # Regex to match 634c634 stuff to split the output
334334
strip_punc = ' <>\n\t!@#$%^&*()\\[]{};:\'""?/`~=+-_'
335335
changes = line_regex.split(output)[1:] # since 0th element is ''
336336
changes = [tuple(i.split('\n---\n')) for i in changes]

0 commit comments

Comments
 (0)