l radio weather: don't fail on unknown ips

This commit is contained in:
lassulus 2023-01-07 23:51:29 +01:00
parent 917889f8fc
commit 0e7a071d81

View File

@ -20,6 +20,7 @@ for ip in fileinput.input():
f'The probability of reincarnation is {random.randrange(0, 100)} percent.'
)
else:
try:
location = geoip.city(ip.strip())
if location.city.geoname_id not in seen:
seen[location.city.geoname_id] = True
@ -41,5 +42,7 @@ for ip in fileinput.input():
f'and a humidity of {weather["current"]["humidity"]} percent. '
f'The probability of precipitation is {weather["hourly"][0]["pop"] * 100:.0f} percent. '
)
except: # noqa E722
pass
print('\n'.join(output))