stow
This commit is contained in:
parent
88a083861c
commit
9f27ccae29
17 changed files with 1685 additions and 0 deletions
25
global/scripts/vimwiki_diary_template
Executable file
25
global/scripts/vimwiki_diary_template
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env python3
|
||||
import datetime
|
||||
import urllib.request
|
||||
from urllib.parse import quote_plus
|
||||
|
||||
|
||||
weather_url = "https://wttr.in/Ottawa?format="
|
||||
url_part = "Time:+%T;+%l:+%c+%t+(%f);+%m;+Precipitation:+%p+(3hour);+Pressure:+%P;+UV index:+%u;+Sunrise:+%S;+Dawn:+%D;"
|
||||
encode_url_part = quote_plus(url_part)
|
||||
|
||||
template = """
|
||||
Date: {date}
|
||||
Weather: {weather}
|
||||
|
||||
== Notes ==
|
||||
"""
|
||||
|
||||
current_date_time = datetime.datetime.now()
|
||||
formatted_date_time = current_date_time.strftime('%a %b %d %H:%M:%S %Z %Y')
|
||||
|
||||
response = urllib.request.urlopen(weather_url + encode_url_part)
|
||||
weather_data = response.read().decode("utf-8").replace("+", " ")
|
||||
|
||||
|
||||
print(template.format(date=formatted_date_time, weather=weather_data))
|
Loading…
Add table
Add a link
Reference in a new issue