import argparse from request_functions import * ''' This script takes in a search query and an output file. It queries the scopus API to find all papers that match the search query, and saves them to the output file. Unlike some of the other scripts in this directory, it does not try to determine the state - if you restart the script, it will start over and blow away whatever you had saved before. ''' years = range(2004, 2017) def main(): parser = argparse.ArgumentParser(description='Output JSON of all articles matching search query') parser.add_argument('-q', help='Search query', required=True) parser.add_argument('-o', help='Where to append JSON results') args = parser.parse_args() with open(args.o, 'w') as out_file: for year in years: get_search_results(args.q, out_file, year=year) if __name__ == '__main__': main()