Repository navigation
2.5
No breaking changes. Both additions below are opt-in: code written against
2.4.1 behaves identically on 2.5.
Pass in your own aiohttp session
Device now takes an optional session:
device = Device(location, session=session)
await device.init()Previously every request opened and closed a ClientSession of its own, so
polling a device meant a new session and TCP connection each time. Supplying a
session reuses it and its connection pool. The session is never closed by this
library — whoever created it owns it. Omitting it keeps the 2.4.1 behaviour.
Errors now come from openhomedevice.exceptions
Callers previously had to import async_upnp_client to catch a failed request,
coupling their error handling to a transitive dependency. Every method that
talks to the device now raises one of:
| Exception | Meaning |
|---|---|
OpenhomeError |
Base class for all of the below |
OpenhomeConnectionError |
The device could not be reached |
OpenhomeTimeoutError |
The device did not answer in time (subclass of the above) |
OpenhomeDeviceError |
The device answered, but refused the request or replied unusably |
The original exception is preserved as __cause__. Because OpenhomeTimeoutError
subclasses OpenhomeConnectionError, catching the latter covers a device that is
off or unreachable for any reason.
Separately, a bare except: in the DIDL-Lite parser is now narrowed to
ParseError and TypeError; as written it also swallowed KeyboardInterrupt
and SystemExit.
Packaging and CI
python_requirescorrected from>=3.6to>=3.10.async_upnp_clienthas
required 3.10 for some time, so the old floor was untrue.- Tests now run on GitHub Actions for every push and pull request, across
Python 3.10, 3.11, 3.12, 3.13 and 3.14.
What's Changed
- Bump version to 2.5 by @bazwilliams in #27
Full Changelog: 2.4.1...2.5