Muhammad Abdur Rahman Saad commited on
Commit
82a33ed
·
1 Parent(s): edb8f2e

add more logging statements

Browse files
Files changed (2) hide show
  1. main.py +1 -1
  2. source/csrc.py +3 -1
main.py CHANGED
@@ -21,7 +21,7 @@ logging.getLogger().setLevel(logging.INFO)
21
  delta = int(os.environ.get('DELTA') or '1')
22
  logging.info("DELTA = %s", delta)
23
 
24
- @flow(name="Data Collection - Main", log_prints=True)
25
  def main():
26
  """
27
  Orchestrates the data collection process by calling the crawl functions of different sources.
 
21
  delta = int(os.environ.get('DELTA') or '1')
22
  logging.info("DELTA = %s", delta)
23
 
24
+ @flow(name="Data Collection - Daily", log_prints=True)
25
  def main():
26
  """
27
  Orchestrates the data collection process by calling the crawl functions of different sources.
source/csrc.py CHANGED
@@ -42,6 +42,7 @@ def crawl(delta):
42
  else:
43
  category_url = f"http://www.csrc.gov.cn/csrc/c100039/common_list_{i}.shtml"
44
  i = i + 1
 
45
  logger.info(category_url)
46
  req = urllib.request.urlopen(category_url)
47
  text = req.read()
@@ -66,7 +67,7 @@ def crawl(delta):
66
  article = {}
67
  url = "http://www.csrc.gov.cn" + url
68
  article['category'] = "Policy Interpretation"
69
- logger.info(url)
70
  crawl_by_url(url, article)
71
  except Exception as error:
72
  logger.error(error)
@@ -130,3 +131,4 @@ def crawl(delta):
130
  except Exception as error:
131
  i = -1
132
  logger.error(error)
 
 
42
  else:
43
  category_url = f"http://www.csrc.gov.cn/csrc/c100039/common_list_{i}.shtml"
44
  i = i + 1
45
+ logger.info(f"Fetching from URL: {category_url}")
46
  logger.info(category_url)
47
  req = urllib.request.urlopen(category_url)
48
  text = req.read()
 
67
  article = {}
68
  url = "http://www.csrc.gov.cn" + url
69
  article['category'] = "Policy Interpretation"
70
+ logger.info(f"Processing article URL: {url}")
71
  crawl_by_url(url, article)
72
  except Exception as error:
73
  logger.error(error)
 
131
  except Exception as error:
132
  i = -1
133
  logger.error(error)
134
+