planet-launcher/planet/web.py

20 lines
420 B
Python
Raw Normal View History

2022-03-26 00:59:39 +00:00
from urllib.request import urlopen
2022-03-24 01:20:58 +00:00
import requests
def get_versions() -> str:
return str(
urlopen(
2022-03-26 00:59:39 +00:00
"https://gist.github.com/leha-code/3e8fea40346536b451e45fc1728ed250/raw/versions.json"
).read(),
"UTF-8",
2022-03-24 01:20:58 +00:00
)
def check_internet() -> bool:
try:
requests.head("http://www.google.com/")
return True
except requests.ConnectionError:
return False