tracinginsights commited on
Commit
e208945
·
1 Parent(s): 29cfc60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -35,8 +35,11 @@ def get_xml(url):
35
  # xpath is only for formula1
36
  # use urllib.parse to check for formula1.com website or other news
37
  xml = pd.read_xml(url,xpath='channel/item')
 
38
 
39
- previous_xml = pd.DataFrame()
 
 
40
 
41
 
42
  # care taken to only consider results where there are more words not a single word quotes
@@ -247,7 +250,7 @@ def send_tweets(speaker_quote):
247
  def check_updates(every=300):
248
  while True:
249
  time.sleep(every)
250
- latest_xml = get_xml()
251
  if ~previous_xml.equals(latest_xml):
252
  print('New articles found')
253
  new_articles_df = latest_xml[~latest_xml["guid"].isin(previous_xml["guid"])]
 
35
  # xpath is only for formula1
36
  # use urllib.parse to check for formula1.com website or other news
37
  xml = pd.read_xml(url,xpath='channel/item')
38
+ return xml
39
 
40
+ cols_list = ['title', 'description', 'link', 'creator', 'guid']
41
+
42
+ previous_xml = pd.DataFrame(columns=cols_list)
43
 
44
 
45
  # care taken to only consider results where there are more words not a single word quotes
 
250
  def check_updates(every=300):
251
  while True:
252
  time.sleep(every)
253
+ latest_xml = get_xml(URL)
254
  if ~previous_xml.equals(latest_xml):
255
  print('New articles found')
256
  new_articles_df = latest_xml[~latest_xml["guid"].isin(previous_xml["guid"])]