killer0071234 / python-zamg Goto Github PK
View Code? Open in Web Editor NEWPython library to read weather data from Geosphere Austria former ZAMG
License: MIT License
Python library to read weather data from Geosphere Austria former ZAMG
License: MIT License
A opened aiohttp session shall not closed by python lib
Detected integration that closes the Home Assistant aiohttp session. Please report issue for zamg using this method at homeassistant/components/zamg/coordinator.py, line 44: device = await self.zamg.update()
Hi @killer0071234 !
Since January 2023 the organizations ZAMG and GBA merged to Geosphere Austria. As a result, the API provided currently under https://dataset.api.hub.zamg.ac.at/v1 will move to a new domain => https://dataset.api.hub.geosphere.at/v1 (not yet public)
This change also comes with infrastructure changes behind the scenes (which will lead to better performance in the future!). In order to not maintain multiple environments we are considering HTTP 301 redirects. However, this would break your package, as you are not following redirects: https://github.com/killer0071234/python-zamg/blob/main/src/zamg/zamg.py#L80
The new domain will be public and the new canonical URL this summer, ideally July.
For users only the domain will change. Any other changes in the future will be announced ahead of time to allow adjustments.
Is there a specific reason why you don't follow redirects? This would be an easy solution for the upcoming change, that doesn't need a lot of coordination.
Is your feature request related to a problem? Please describe.
The problem is, that with the current Api (OGD) there are only a few stations availible.
Describe the solution you'd like
Using the new Api provided by Zamg, would support all stations. (Doku, Example)
Describe alternatives you've considered
I think there is no alternative solution.?
Additional context
Example Request:
https://dataset.api.hub.zamg.ac.at/v1/station/current/tawes-v1-10min?parameters=TL,P,FFAM&station_ids=11035
to request Temperature, Pressure and Windspeed.
0.2.1
Unfortunately, I cannot provide a detailed description, but please check your logic for calls to ZAMG servers. We receive calls to both the metadata and data endpoints far more often than every 10 min. With an increasing number of users of this plugin, this is putting a heavy load on our servers.
Not applicable.
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000020CFE6C6550>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x0000020CFE73C520>, 352568.39)]']
connector: <aiohttp.connector.TCPConnector object at 0x0000020CFF040C10>
Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x0000020CFF022220>
transport: <_ProactorSocketTransport fd=932 read=<_OverlappedFuture cancelled>>
Traceback (most recent call last):
File "C:\Users\Arnold\AppData\Local\Programs\Python\Python39\lib\asyncio\sslproto.py", line 684, in _process_write_backlog
self._transport.write(chunk)
File "C:\Users\Arnold\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 359, in write
self._loop_writing(data=bytes(data))
File "C:\Users\Arnold\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 395, in _loop_writing
self._write_fut = self._loop._proactor.send(self._sock, data)
AttributeError: 'NoneType' object has no attribute 'send'
Exception ignored in: <function _SSLProtocolTransport.del at 0x0000020CFE5AC1F0>
Traceback (most recent call last):
File "C:\Users\Arnold\AppData\Local\Programs\Python\Python39\lib\asyncio\sslproto.py", line 321, in del
File "C:\Users\Arnold\AppData\Local\Programs\Python\Python39\lib\asyncio\sslproto.py", line 316, in close
File "C:\Users\Arnold\AppData\Local\Programs\Python\Python39\lib\asyncio\sslproto.py", line 593, in _start_shutdown
File "C:\Users\Arnold\AppData\Local\Programs\Python\Python39\lib\asyncio\sslproto.py", line 598, in _write_appdata
File "C:\Users\Arnold\AppData\Local\Programs\Python\Python39\lib\asyncio\sslproto.py", line 706, in _process_write_backlog
File "C:\Users\Arnold\AppData\Local\Programs\Python\Python39\lib\asyncio\sslproto.py", line 720, in _fatal_error
File "C:\Users\Arnold\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 151, in _force_close
File "C:\Users\Arnold\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
File "C:\Users\Arnold\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed
kommm da leider nicht weiter? (Beispielcode)
Aber ein super Tool ist die Klasse :-)
Danke Lg
v.0.36
get timeout with
CLIENT_AGENT = f"Python/{version_info[0]}.{version_info[1]} +https://github.com/killer0071234/python-zamg python-zamg/{version}"
works with
USER_AGENT: "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_4_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15"
Is your feature request related to a problem? Please describe.
Now the program allows to get sensor data for one location.
Describe the solution you'd like
According to information on geosphere.at homepage there should be also a forecast be available
Additional context
Link to the forecast model: https://data.hub.geosphere.at/dataset/nwp-v1-1h-2500m
0.1.1
if the variable self._station_id
is none, the except will generate a TypeError
exception.
Relevant part of log:
File "/usr/local/lib/python3.9/site-packages/zamg/zamg.py", line 132, in get_station_name
return "Unknown station with id: " + self._station_id
TypeError: can only concatenate str (not "NoneType") to str
Is your feature request related to a problem? Please describe.
It is probably also helpful to have more meaningful information about the plugin/user-agent. Please include an URL (e.g. this github repo) and the version number of this integration. (Other best practices regarding user agents: https://developers.whatismybrowser.com/learn/browser-detection/user-agents/user-agent-best-practices) This can help with analyzing such situations.
Describe the solution you'd like
The header has now as user agent python-zamg
. It shall also include the api version and url. Prefered url is this repo.
Additional context
Originally posted by @Langdi in #104 (comment)
0.1.1
Looks like ZAMG changed their timestamp format yesterday. They removed the seconds.
I'm not sure if this is a permanent change and therefore worth fixing.
At least I can't find any change logs from ZAMG.
Of course, that also breaks the home assistant integration, see home-assistant/core#83988
This is a trace from home assistant:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/components/zamg/coordinator.py", line 44, in _async_update_data
self.data["last_update"] = self.zamg.last_update
File "/usr/local/lib/python3.10/site-packages/zamg/zamg.py", line 142, in last_update
return datetime.strptime(
File "/usr/local/lib/python3.10/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/local/lib/python3.10/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '2022-12-14T23:00+00:00' does not match format '%Y-%m-%dT%H:%M:%S+00:00'
Is your feature request related to a problem? Please describe.
If there are any issues during update return a exception instead of strange return values
Describe the solution you'd like
Raise of custom exceptions if something goes wrong
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
We want to add the coverage badge
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
v0.1.1
a call of session.get
can raise TimeoutError
or ClientConnectorError
if the server is not reachable or the hostname is invalid
Traceback (most recent call last):
File "/workspaces/python-zamg/control.py", line 31, in <module>
asyncio.run(main())
File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/workspaces/python-zamg/control.py", line 11, in main
data = await zamg.closest_station(46.99, 15.499)
File "/workspaces/python-zamg/src/zamg/zamg.py", line 97, in closest_station
if (stations := await self.zamg_stations()) is None:
File "/workspaces/python-zamg/src/zamg/zamg.py", line 60, in zamg_stations
response = await self.session.get(
File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 535, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 542, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 907, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1166, in _create_direct_connection
raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host dataset.api.hub.zamg11.ac.at:443 ssl:default [Name or service not known]
Is your feature request related to a problem? Please describe.
There shall be a possibility to set station parameter to read
Describe the solution you'd like
_station_parameters
external accessable
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
Possibility to disable ssl error check
Describe the solution you'd like
Add parameter verify_ssl
to lib
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
a call of client.update()
without leading call of client.zamg_stations()
causes a error.
caused by a empty variable self._station_parameters
can only concatenate str (not "NoneType") to str
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.