File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ def printlist(js):
1919 project_id = item ["project_id" ]
2020 project_name = item ["project_name" ]
2121 except KeyError :
22- sys .stderr .write (repr (item ))
22+ sys .stderr .write (repr (item ) + " \n " )
2323 sys .stdout .write (("\t " .join ([item ["metagenome_id" ],
2424# str(len(item.keys())),
2525 repr (public ), item ["created_on" ],
@@ -46,13 +46,17 @@ def printlist(js):
4646total_count = int (jsonstructure ["total_count" ])
4747sys .stderr .write ("Total number of records: {:d}\n " .format (total_count ))
4848
49- for i in range (0 , int (total_count / limit ) + 1 ):
50- sys .stderr .write ("Page {:d}\t " .format (i ))
49+ for i in range (0 , int (total_count / limit ) + 2 ):
50+ # sys.stderr.write("Page {:d}\t".format(i))
51+ sys .stdout .write ("Page {:d}\t {}\n " .format (i , base_url ))
5152 jsonstructure = obj_from_url (base_url , auth = key )
5253 printlist (jsonstructure )
53- time .sleep (3 )
54- try :
54+ time .sleep (1 )
55+ if "next" in jsonstructure . keys () :
5556 next_url = jsonstructure ["next" ]
5657 base_url = next_url
57- except KeyError :
58+ continue
59+ else :
60+ sys .stderr .write ("No next, page {} url {} \n " .format (i , base_url ))
61+ sys .stderr .write (repr (jsonstructure ))
5862 break
You can’t perform that action at this time.
0 commit comments