Skip to content

Commit 9b674f8

Browse files
author
kRHYME7
committed
fix: Provide request package for weather.py and versioned requirements
1 parent d4cdf18 commit 9b674f8

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
loguru
2-
hyprpy
3-
pywayland
1+
loguru==0.7.3
2+
pulsectl==24.12.0
3+
pywayland==0.4.18
4+
requests==2.32.3

Configs/.local/lib/hyde/weather.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@
44
import sys
55
import json
66
from datetime import datetime
7-
import requests
7+
8+
9+
import pyutils.pip_env as pip_env
10+
11+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
12+
pip_env.v_import(
13+
"requests"
14+
) # fetches the module by name // does `pip install --update requests` under the hood
15+
import requests # noqa: E402
16+
817

918
### Constants ###
1019
WEATHER_CODES = {
@@ -51,7 +60,7 @@
5160

5261
### Functions ###
5362
def load_env_file(filepath):
54-
with open(filepath, encoding='utf-8') as f:
63+
with open(filepath, encoding="utf-8") as f:
5564
for line in f:
5665
if line.strip() and not line.startswith("#"):
5766
if line.startswith("export "):
@@ -204,9 +213,9 @@ def format_chances(hour):
204213
) # Number of days to show the forecast for (default: 3)
205214
except ValueError:
206215
FORECAST_DAYS = 3
207-
get_location = os.getenv(
208-
"WEATHER_LOCATION", ""
209-
).replace(" ", "_") # Name of the location to get the weather from (default: '')
216+
get_location = os.getenv("WEATHER_LOCATION", "").replace(
217+
" ", "_"
218+
) # Name of the location to get the weather from (default: '')
210219
# Parse the location to wttr.in format (snake_case)
211220

212221
# Check if the variables are set correctly

0 commit comments

Comments
 (0)