diff --git a/.gitignore b/.gitignore index 133e6be..d2e98b3 100644 --- a/.gitignore +++ b/.gitignore @@ -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 - diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..89e1616 --- /dev/null +++ b/.vscode/settings.json @@ -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 +} \ No newline at end of file diff --git "a/Icon\r" "b/Icon\r" new file mode 100644 index 0000000..e69de29 diff --git a/playground.py b/playground.py new file mode 100644 index 0000000..fc389e1 --- /dev/null +++ b/playground.py @@ -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())