Update
This commit is contained in:
parent
e516aee630
commit
860e67a65e
7
.gitignore
vendored
7
.gitignore
vendored
@ -28,6 +28,9 @@ share/python-wheels/
|
|||||||
*.egg
|
*.egg
|
||||||
MANIFEST
|
MANIFEST
|
||||||
|
|
||||||
|
secrets
|
||||||
|
secrets/*
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# 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.
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
@ -136,7 +139,8 @@ dmypy.json
|
|||||||
.LSOverride
|
.LSOverride
|
||||||
|
|
||||||
# Icon must end with two \r
|
# Icon must end with two \r
|
||||||
Icon
|
Icon
|
||||||
|
|
||||||
|
|
||||||
# Thumbnails
|
# Thumbnails
|
||||||
._*
|
._*
|
||||||
@ -156,4 +160,3 @@ Icon
|
|||||||
Network Trash Folder
|
Network Trash Folder
|
||||||
Temporary Items
|
Temporary Items
|
||||||
.apdisk
|
.apdisk
|
||||||
|
|
||||||
|
|||||||
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal 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
|
||||||
|
}
|
||||||
26
playground.py
Normal file
26
playground.py
Normal 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())
|
||||||
Loading…
Reference in New Issue
Block a user