Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- quality/functionality/facts/tools/screenshots/extract_fact_data/__main__.py (index)
- +++ quality/functionality/facts/tools/screenshots/extract_fact_data/__main__.py (working tree)
- @@ -100,9 +100,12 @@ class DataParser:
- return None
- def __call__(self, row):
- - with urllib.request.urlopen(row[self.url_column]) as response:
- - html = response.read().decode(response.headers.get_content_charset()).replace("\\n", "")
- - blender_response = self.read_blender_response(html)
- + try:
- + with urllib.request.urlopen(row[self.url_column]) as response:
- + html = response.read().decode(response.headers.get_content_charset()).replace("\\n", "")
- + blender_response = self.read_blender_response(html)
- + except (urllib.error.HTTPError, TimeoutError, urllib.error.URLError) as e:
- + blender_response = None
- if blender_response is None:
- yield yt.create_table_switch(1)
- @@ -112,6 +115,7 @@ class DataParser:
- data = self.transform_response_data(blender_response)
- fact = fact_parser_lib.parse_fact(data, ignore_highlight=True)
- fact[self.url_column] = row[self.url_column]
- + fact["max_answer_mx"] = blender_response.get("data.wizplaces.important.[0].construct.[0]", {}).get("fact_snip_additional_data", {}).get("max_answer_mx", -100.0)
- yield yt.create_table_switch(0)
- yield fact
- @@ -125,7 +129,8 @@ def main():
- [
- args.output,
- args.errors
- - ]
- + ],
- + job_count = 100
- )