Compare commits
5 Commits
7277a5da9d
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
a5af30df6f
|
|||
|
e291f232ba
|
|||
|
3b3d7c5247
|
|||
|
1dc30200fd
|
|||
|
02d7245212
|
@@ -1,3 +1,5 @@
|
|||||||
# Weather (Python)
|
# Weather (Python)
|
||||||
|
|
||||||
Recreating a weather reporting app from Laravel to Flask
|
Recreating a weather reporting app from Laravel to Flask
|
||||||
|
|
||||||
|
<img src="./screenshot.png" width="200" />
|
||||||
|
|||||||
12
pyproject.toml
Normal file
12
pyproject.toml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[project]
|
||||||
|
name = "weather"
|
||||||
|
version = "1.0.0"
|
||||||
|
description = "A little weather app"
|
||||||
|
dependencies = [
|
||||||
|
"flask",
|
||||||
|
"requests",
|
||||||
|
]
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["flit_core<4"]
|
||||||
|
build-backend = "flit_core.buildapi"
|
||||||
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 888 KiB |
@@ -10,12 +10,8 @@ bp = Blueprint('api', __name__)
|
|||||||
@bp.route('/api')
|
@bp.route('/api')
|
||||||
def api():
|
def api():
|
||||||
db = get_db()
|
db = get_db()
|
||||||
latest_period = dict(db.execute(
|
|
||||||
'SELECT `id` FROM `reports` WHERE `type` = "hourly" ORDER BY `reported_at` DESC'
|
|
||||||
).fetchone())
|
|
||||||
|
|
||||||
current_conditions = dict(db.execute(
|
current_conditions = dict(db.execute(
|
||||||
f"SELECT * FROM `periods` WHERE `report_id` = {latest_period['id']} LIMIT 1"
|
"SELECT * FROM `current_forecasts` WHERE DATETIME('now', 'localtime') BETWEEN `start_time` AND `end_time` LIMIT 1"
|
||||||
).fetchone())
|
).fetchone())
|
||||||
|
|
||||||
return current_conditions
|
return current_conditions
|
||||||
|
|||||||
Reference in New Issue
Block a user