Skip to content

Instantly share code, notes, and snippets.

@imbilltucker
Created September 29, 2021 02:25
Show Gist options
  • Save imbilltucker/3a37d0843c36a1c4ba4d1941628601b5 to your computer and use it in GitHub Desktop.
Save imbilltucker/3a37d0843c36a1c4ba4d1941628601b5 to your computer and use it in GitHub Desktop.
import requests
CHOICES = {
'1': '3-Day Forcast',
'2': 'WWV Geophysical Alert Message',
'3': '27-day Space Weather Outlook',
}
URLS = {
'3-Day Forcast':
'https://services.swpc.noaa.gov/text/wwv.txt',
'WWV Geophysical Alert Message':
'https://services.swpc.noaa.gov/text/wwv.txt',
'27-day Space Weather Outlook':
'https://services.swpc.noaa.gov/text/27-day-outlook.txt',
}
prWhite = '\033[93m {}\033[00m'.format('''
NOAA SOLAR WEATHER AND PROPAGATION By: Mike-KD2KOG v1.0 2021
1. 3-Day Forcast
2. WWV Geophysical Alert Message
3. 27-day Space Weather Outlook
4. Exit/Quit
''')
print(prWhite)
while ans := input('Make a selection '):
if choice := CHOICES.get(ans):
response = requests.get(URLS.get(choice))
print()
print(response.text)
else:
print()
print("That is not a valid choice")
print('Goodbye!')
break
print(prWhite)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment