if "--version" in argument_list: show_version() if "--search" not in argument_list: # print bcolors.bcolors.bred("Enter vendor product to search.") show_help() sys.exit(1) if "--outfile" not in argument_list: print bcolors.bcolors.bred("Outfile was not found, outfile will match to the keywords.") print bcolors.bcolors.bred("Example: \n Keyword : LED strip lights") print bcolors.bcolors.bred(" \n Outfile : led-strip-lights.csv") argument_count = len(sys.argv) if argument_count >= 3: search_index = argument_list.index("--search") search_keyword = argument_list[search_index + 1] query_string = urllib.urlencode({"field-keywords": search_keyword}) url = "http://www.amazon.com/s/?" + query_string print "Scrapping : " + bcolors.bcolors.bgreen(url) s = Scraper(url) s.set_output_file(search_keyword) s.main() else: # print bcolors.bcolors.bred("Enter vendor product to search.") show_help()