IronOneAILabs commited on
Commit
822b2e3
1 Parent(s): 46023d5

Fix bug if crawler returns None for fields - ds

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -49,10 +49,20 @@ def fetch_text(url,api_key):
49
  print("response",response)
50
  if response.status_code == 200:
51
  print("response.json()",response.json())
 
52
  maintext_text = json.loads(response.json())['maintext']
53
  summary_text = json.loads(response.json())['description']
54
  title_text = json.loads(response.json())['title']
55
 
 
 
 
 
 
 
 
 
 
56
 
57
  return maintext_text, summary_text, title_text
58
  else :
 
49
  print("response",response)
50
  if response.status_code == 200:
51
  print("response.json()",response.json())
52
+
53
  maintext_text = json.loads(response.json())['maintext']
54
  summary_text = json.loads(response.json())['description']
55
  title_text = json.loads(response.json())['title']
56
 
57
+ If maintext_text is None:
58
+ maintext_text = ""
59
+
60
+ If summary_text is None:
61
+ summary_text = ""
62
+
63
+ If summary_text is None:
64
+ summary_text = ""
65
+
66
 
67
  return maintext_text, summary_text, title_text
68
  else :