mirror of https://gitlab.com/ceda_ei/sky
Compare commits
3 Commits
63213d43df
...
fae99965c6
Author | SHA1 | Date |
---|---|---|
Ceda EI | fae99965c6 | |
Ceda EI | 5d67e85b78 | |
Ceda EI | d3f21f7ec0 |
|
@ -13,3 +13,5 @@ To check weather for your location simply run the following command in a termina
|
|||
### In Fahrenheit
|
||||
+ Weather for one week - `curl sky.webionite.com/f/location`
|
||||
+ Weather for today - `curl sky.webionite.com/f/location/t`
|
||||
|
||||
Replace sky.webionite.com/ with sky.webionite.com/p/ on Windows
|
||||
|
|
30
server.py
30
server.py
|
@ -150,6 +150,8 @@ def index():
|
|||
"In Fahrenheit\n"
|
||||
"+ Weather for one week - curl sky.webionite.com/f/location \n"
|
||||
"+ Weather for today - curl sky.webionite.com/f/location/t\n\n"
|
||||
"Replace sky.webionite.com/ with sky.webionite.com/p/ on "
|
||||
"Windows \n\n"
|
||||
+ config.source + "\n")
|
||||
return text
|
||||
|
||||
|
@ -162,6 +164,10 @@ def main(location, geocoder, cache_db, kind, unit):
|
|||
"https://darksky.net/poweredby/\n")
|
||||
|
||||
|
||||
def strip_colors(text):
|
||||
return re.sub('\033\\[[0-9;]+?m', '', text)
|
||||
|
||||
|
||||
app.add_url_rule('/<location>', 'location', lambda location:
|
||||
main(location, geocoder, cache_db, "daily", "c"))
|
||||
|
||||
|
@ -179,3 +185,27 @@ app.add_url_rule('/f/<location>/', 'location_f/', lambda location:
|
|||
|
||||
app.add_url_rule('/f/<location>/t', 'today_location_f', lambda location:
|
||||
main(location, geocoder, cache_db, "hourly", "f"))
|
||||
|
||||
app.add_url_rule('/p/<location>', 'plain_location', lambda location:
|
||||
strip_colors(main(location, geocoder, cache_db, "daily",
|
||||
"c")))
|
||||
|
||||
app.add_url_rule('/p/<location>/', 'plain_location/', lambda location:
|
||||
strip_colors(main(location, geocoder, cache_db, "daily",
|
||||
"c")))
|
||||
|
||||
app.add_url_rule('/p/<location>/t', 'plain_today_location', lambda
|
||||
location: strip_colors(main(location, geocoder, cache_db,
|
||||
"hourly", "c")))
|
||||
|
||||
app.add_url_rule('/p/f/<location>', 'plain_location_f', lambda location:
|
||||
strip_colors(main(location, geocoder, cache_db, "daily",
|
||||
"f")))
|
||||
|
||||
app.add_url_rule('/p/f/<location>/', 'plain_location_f/', lambda location:
|
||||
strip_colors(main(location, geocoder, cache_db, "daily",
|
||||
"f")))
|
||||
|
||||
app.add_url_rule('/p/f/<location>/t', 'plain_today_location_f', lambda
|
||||
location: strip_colors(main(location, geocoder, cache_db,
|
||||
"hourly", "f")))
|
||||
|
|
Loading…
Reference in New Issue