This commit is contained in:
Max 2020-10-18 23:59:02 +01:00
parent e516aee630
commit 860e67a65e
4 changed files with 37 additions and 2 deletions

7
.gitignore vendored
View File

@ -28,6 +28,9 @@ share/python-wheels/
*.egg
MANIFEST
secrets
secrets/*
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
@ -136,7 +139,8 @@ dmypy.json
.LSOverride
# Icon must end with two \r
Icon
Icon
# Thumbnails
._*
@ -156,4 +160,3 @@ Icon
Network Trash Folder
Temporary Items
.apdisk

6
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"python.pythonPath": "/Users/max/Desktop/ICL-IoT-Weather/venv/bin/python3.7",
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true
}

0
Icon Normal file
View File

26
playground.py Normal file
View File

@ -0,0 +1,26 @@
from firebase_admin import credentials, firestore, initialize_app
from requests import get as api_get
cert_path = "secrets/icl-iot-weather-firebase-adminsdk-d2a8f-577125a0ff.json"
cred = credentials.Certificate(cert_path)
initialize_app(cred)
firestore_db = firestore.client()
#firestore_db.collection(u'songs').add({'song': 'Imagine', 'artist': 'John Lennon'}
with open("secrets/weather_api_key.txt", "r") as api_key_file:
api_key = api_key_file.read()
request_endpoint = "api.openweathermap.org/data/2.5/weather"
request_city = "London"
request_url = f"https://{request_endpoint}?q={request_city}&appid={api_key}"
print(request_url)
api_rsp = api_get(request_url)
print(api_rsp.text)
# snapshots = list(firestore_db.collection(u'weather_data').get())
# for snapshot in snapshots:
# print(snapshot.to_dict())