]> code.communitydata.science - covid19.git/blobdiff - bin/fetch_daily_views.py
all data
[covid19.git] / bin / fetch_daily_views.py
index ac925eda81d3062dbb21f4cde93092ded6bce6b2..5ce989f4f0e2e9e7cb96439d6d7708ff89d1556c 100755 (executable)
 ###############################################################################
 
 
-#1 Load up the list of article names
-
-#2 Repeatedly call the API with that list of names
-
-#3 Save results as a TSV
-
 import requests
 import argparse
 import json
@@ -55,8 +49,9 @@ def main():
 
 
     articleList = []
+#1 Load up the list of article names
+
     with open(articleFile, 'r') as infileHandle:
-        #theInfile = csv.reader(infileHandle, quotechar='"')
         theInfile = csv.reader(infileHandle)
         next(theInfile) #skip header
         for currentLine in theInfile:
@@ -69,6 +64,8 @@ def main():
 
     i = 0 #iterator to deal with end of file
 
+#2 Repeatedly call the API with that list of names
+
     for a in articleList:
         a = a[0] #destringify
         i = i+1
@@ -80,6 +77,7 @@ def main():
             j.append(jd["items"][0])
             time.sleep(.1)
 
+#3 Save results as a JSON and TSV
 
     #all data in j now, make json file
     with open(j_Out, 'w') as j_outfile: 

Community Data Science Collective || Want to submit a patch?