Noticed that the weather segments disappeared, checked powerline log which contained
2019-01-08 12:28:22,330:ERROR:tmux:WeatherSegment:Exception while computing state for 'London,United Kingdom,GB': <urlopen error [Errno -5] No address associated with hostname>
It seems that the URL powerline uses is no longer supported by Yahoo since
03/Jan:
Important EOL Notice: As of Thursday, Jan. 3, 2019, the weather.yahooapis.com and query.yahooapis.com for Yahoo Weather API will be retired.
To continue using our free Yahoo Weather APIs, use https://weather-ydn-yql.media.yahoo.com/forecastrss. Contact [email protected] for credentials to onboard to this free Yahoo Weather API service.
For the record, here's the relevant section of the log
2019-01-08 12:28:22,330:ERROR:tmux:WeatherSegment:Exception while computing state for 'London,United Kingdom,GB': <urlopen error [Errno -5] No address associated with hostname>
Traceback (most recent call last):
File "/home/souto/.local/lib/python3.6/site-packages/powerline/lib/threaded.py", line 197, in render
update_state = queries[key][1]
KeyError: 'London,United Kingdom,GB'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/usr/lib/python3.6/http/client.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/usr/lib/python3.6/socket.py", line 704, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -5] No address associated with hostname
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/souto/.local/lib/python3.6/site-packages/powerline/lib/threaded.py", line 220, in update_one
updates[key] = (monotonic(), self.compute_state(key))
File "/home/souto/.local/lib/python3.6/site-packages/powerline/segments/common/wthr.py", line 140, in compute_state
raw_response = urllib_read(url)
File "/home/souto/.local/lib/python3.6/site-packages/powerline/lib/url.py", line 15, in urllib_read
return urlopen(url, timeout=10).read().decode('utf-8')
File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib/python3.6/urllib/request.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -5] No address associated with hostname>
I couldn't find any issue describing this, apologies is it's duplicate.
It would be straightforward to write a new segment using the OpenWeatherMap API but as far as I can tell this repo seems abandoned. I'd be willing to work on the segment if an admin could reply and confirm that the repo is active and that they'd be willing to merge it.
We can start with a pull request to move the API, i'm available if you need more hands to code this...
One more hand here if any help is need to migrate the API
@barra51 @mp1118 when do we start?
@gsusrafael For me, it's OK if we start right now :)
i've forked the repo, i'm checking this info https://blog.rapidapi.com/access-global-weather-data-with-these-weather-apis/ to check our options for a Weather Info Gathering....
Just wanted to throw in https://wttr.in as another option, because of it's simplicity
@liketechnik your suggestion is even better... i think could be a painless transition
@liketechnik the only thing i'm still looking for in wttr.in is the posibility to dump the info in JSON...
I'm not sure if this is possible with wttr.in :/ What I found in the Readme is the possibility of having custom formatting and returning the current weather in a single line (https://github.com/chubin/wttr.in#one-line-output)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
that could be an interesting proposal for wttr.in, i've been looking into their
issues list and i've found some requests asking for JSON output format... that
could be really nice if this feature comes integrated on any further release of
wttr.in and then we could use it, but right now let's do something which could
be reusable and/or pluggable to any weather API provider.
On 2019-Mar-15 13:31:03, Florian Warzecha wrote:
I'm not sure if this is possible with wttr.in :/ What I found in the Readme is the possibility of having custom formatting and returning the current weather in a single line (https://github.com/chubin/wttr.in#one-line-output)
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/powerline/powerline/issues/1973#issuecomment-473431217
Jesus Rafael Sanchez
"Inter fractal umbras et illusionibus evanuit somnia ..."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBAgAGBQJcjBAvAAoJEBKYkbOSUaVWlPwP/3tBQWeBbpxPjZ7N8YxCsIyr
/2F3Y1+OHViEosq6UOZu1SlTXZUB4tFb7Iu9/7Lf6xordPPAW/7S0c35/I9sTYgJ
dBuoi+rnNhTwVaisyu6Grl02mxTdItNlCI+SiZq36utuDEgUhCaUZa2NrRf3zT5h
341myYD3gwNvvj086z3nqorzV2usRF5N+RsajnP3q0EtmgceMcaCkFyaATrNJYVB
7r3UIO7DJgv0f+NZESSrAHHSXw0ni6PVdkh2CdQ9Qxfu8/7UFSw9jMBeXEG2vaAV
l4jEOZ6N9diN6kOYsgkcicE6bMFwx9g90HHM4/HakUCeTuOD2opFkMv/C05gIJ9f
nf5y9/KFkS2MN65Nl+F7A+HJ9JoW9kZ5b6uO034VDnckCvVpY5gLmPW9JTkEFs7g
0WnwAW8QJ+I9tZdhP/SDcoSgKVpOfpy0bG284PQ6IQpoKIp8ykndZF6V3xGVkV7x
ZlN1f6xzfLuYIIbg7ZHjJfEMGDzosM0mTERp8PHWcM2MKgnmmB+JrqvVSfufCqBe
0ZbJSe5QQvVR/saY0bn3vDf3bmFNr1vlr/YsJF64ODUGj1tel0vVeNLIywDkAr5Z
1SrCs+ii0uAM6XyrFskrIE3Gbct9KRCRSDX1EFvbRM5N0QM+ZTrolBRWfNE0MEN4
TWXs9vL+fMIE53L1vtgq
=u1tZ
-----END PGP SIGNATURE-----
https://github.com/USA-RedDragon/powerline/commit/352bf96335d0ebd63acc996316af94b1394c8595
Implemented crappy support for Wttr.in. Ideally, we'd use a more professional api that is configurable and more verbose, but this works as an "at a glance" weather feature.

You are damn right... wttr.in doesn't fulfill the specs for a full weather
API
El dom., 17 de mar. de 2019 7:05 AM, Jacob McSwain notifications@github.com
escribió:
USA-RedDragon@352bf96
https://github.com/USA-RedDragon/powerline/commit/352bf96335d0ebd63acc996316af94b1394c8595Implemented crappy support for Wttr.in. Ideally, we'd use a more
professional api that is configurable and more verbose, but this works as
an "at a glance" weather feature.[image: Screen Shot 2019-03-17 at 6 05 06 AM]
https://user-images.githubusercontent.com/13051767/54489483-b1efbf00-487a-11e9-8bf1-abd6372cc5df.png—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/powerline/powerline/issues/1973#issuecomment-473655191,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA39c7P7kL6gxIm7t0H1J4SP4ZPSXOnFks5vXiGRgaJpZM4Z1bYx
.
Any update on this?
it seems @gsusrafael @USA-RedDragon made some progress with wttr.in but after that I thing the guys are not working anymore in this issue ...
Unfortunately it seems this repo isn't being actively maintained, last PR merge was back in Nov 11, 2018.
I may be a bit naive about this, but is this just short of your requirements?

set -g status-interval 60
WEATHER='#(curl -s wttr.in/London:Stockholm:Moscow\?format\="%%l:+%%c%%20%%t%%60%%w&period=60")'
set -g status-right "$WEATHER ..."
Correct @CollinChaffin. I've been using it locally for some time but it's not a good API. I actually forgot about this, I'll look into it more today
As it turns out the GeoIP service it uses is also shut down: https://geoip.nekudo.com/shutdown
As it turns out the GeoIP service it uses is also shut down: https://geoip.nekudo.com/shutdown
@USA-RedDragon please check using ifconfig.co or api.ipapi.com
How's the status on this? If someone creates a PR, I'd be willing to merge it (conditioned on that it contains the necessary tests).
Further, I'd consider removing the old segment if it doesn't work anymore (and apparently will never work again, as I understand it).
if i'm not wrong we could use wttr.in and ifconfig.co as replacements for
IP and Weather API
Jesus Rafael Sanchez Medrano
"Life is a dream, of which all must wake up"
On Thu, Sep 26, 2019 at 3:39 AM Philip Wellnitz notifications@github.com
wrote:
How's the status on this? If someone creates a PR, I'd be willing to merge
it (conditioned on that it contains the necessary tests).Further, I'd consider removing the old segment if it doesn't work anymore
(and apparently will never work again, as I understand it).—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/powerline/powerline/issues/1973?email_source=notifications&email_token=AAG7246IFIXXLINJLQZ7UUDQLRRKBA5CNFSM4GOVWYY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7UUENA#issuecomment-535380532,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAG72465C5JOTWA2YAL4P4LQLRRKBANCNFSM4GOVWYYQ
.
Hi I just came to use powerline with tmux less than a week ago and absolutely love it. It was sad for me to find weather segment stops to work and the repostitory is not under active maintenance now. I did make an attempt last night, to modify segments.wthr to use wttr.in as suggested by this thread. The modifications are really simple, but they don't work (still no weather segment shows up). I don't have much experience with this code base, and don't even know how to debug it (couldn't find the log). Hence I am pasting the simple code here, hoping someone can help move this forward. Just because I really love this project. If you also love this project and has more experience of writing segment, please help me here:)
class WeatherSegment(KwThreadedSegment):
interval = 600
url_trunk = "wttr.in/"
def __call__ (self, pl, update_first=True,
location_query="Santa Clara,California",
temp_coldest=30,
temp_hottest=100,
icons=None,
**kwargs):
self.location_query=location_query
self.temp_coldest=temp_coldest
self.temp_hottest=temp_hottest
super(KwThreadedSegment, self).__call__(self, pl, update_first,
location_query=location_query,
temp_coldest=temp_coldest,
temp_hottest=temp_hottest,
icons=icons,
**kwargs)
@staticmethod
def key(**kwargs):
return "default_query"
def compute_state(self, default_query):
url_loc = '+'.join(self.location_query.split())
url = url_trunk + url_loc + '?' + 'u&format="%c:%t"'
response = urllib_read(url.encode('utf-8'))
if not response:
self.error('Failed to get response')
return None
return response
def render_one(self, query_response, icons=None, unit='C', temp_format=None, temp_coldest=-30, temp_hottest=40, **kwargs):
if not query_response:
return None
icon,temp_string=query_response.split(':')
match = re.match(r'([+-]*\d+)', temp_string)
if match.group(1) is None:
self.error('Fail to get temperature')
return None
temp = int(match.group(1))
if temp <= self.temp_coldest:
gradient_level = 0
elif temp >= self.temp_hottest:
gradient_level = 100
else:
gradient_level = (temp - self.temp_coldest) * 100.0 / (self.temp_hottest - self.temp_coldest)
return [
{
'contents': icon + ' ',
'highlight_groups': ['weather'],
'divider_highlight_group': 'background:divider',
},
{
'contents': temp_string,
'highlight_groups': ['weather_temp_gradient', 'weather_temp', 'weather'],
'divider_highlight_group': 'background:divider',
'gradient_level': gradient_level,
},
]
I'm doing some efforts in porting the weather plugin to OpenWeatherMap.
Unfortunately an API key is required for that, however OpenWeatherMap states that it is supporting FOSS, will try if I get an API key with increased limits from there
Any updates on this? Is a shame that this doesn't seem to be active. The segment is still broken. I've switched to other projects on most of my computers, but I still have some Linux using powerline which this would be nice on.
Well, my PR is still open
I did not take any action regarding that PR, because you, @StopMotionCuber, wrote “This is not really ready for merging yet”, so I assumed that the PR was/is still WIP.
Personally, I'm not against having segments where a user needs to provide credentials-like information in the config (in fact the IMAP segment works similarly); thus, I can imagine merging the PR once it is ready...
Could we just get it merged and add some clarifying information in the documentation that an API key needs to be added? I get the concern about this being kind of hacky, but honestly this is better than the nothing we have right now. I'd be glad to help if there's anything missing you need help with @StopMotionCuber :smiley:
Oh, the only thing I'm missing on is time, but otherwise I can go on with this PR.
Will try to push that PR forward within the next few days, maybe already tonight.
Update on my PR:
I did some work now, and it's working on my machine (¯_(ツ)_/¯) however some tests are failing as they are based on stubbed urllib request answers which I have not yet replaced with the APIs that I'm using.
Also I introduced a (test)-breaking change, that the temperature gradient is calculated based on minimum and maximum value of your unit (before it was the unit that you would get from the request).
Otherwise I'm quite annoyed working on this issue with my new MacBook, as there seems to be some Ice Lake CPU Bug that is crashing PyCharm and/or macOS 😡
Fixed in #2038
Most helpful comment
It would be straightforward to write a new segment using the OpenWeatherMap API but as far as I can tell this repo seems abandoned. I'd be willing to work on the segment if an admin could reply and confirm that the repo is active and that they'd be willing to merge it.