Skip to content

Commit

Permalink
added user option to create API key
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKohanim committed May 5, 2019
1 parent e4e721c commit 10ee900
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions get_news.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
try:
with open(file_location, 'r') as api_file:
api_key = api_file.readline().strip()
except FileNotFoundError:
print("API key file not found, let's make it together")
api_key = prompt("Please paste your key here: ")
with open(file_location, "w") as newApiFile:
newApiFile.write(api_key + "\n")
print("API File created successfully at:", file_location)
except FileNotFoundError:
print("API key file not found, let's make it together")
api_key = prompt("Please paste your key here: ")
with open(file_location, "w") as newApiFile:
newApiFile.write(api_key + "\n")
print("API File created successfully at:", file_location)

arguments = len(sys.argv)
sort_type = "top-headlines" if arguments < 2 or sys.argv[1] == "top" else "everything"
Expand Down

0 comments on commit 10ee900

Please sign in to comment.