INNER CODE UNIT · Python
_fetch_icon_png_blob
rio-labs/rio · rio/app.py:419
async def _fetch_icon_png_blob(self) -> bytes:
"""
Fetches the app's icon as a PNG blob.
The result is cached. It will be loaded the first time you call this
method, and then returned immediately on subsequent calls. If fetching
the icon fails, the error is logged and the default icon used.
"""
# Already cached?
if self._icon_as_png_blob is not None:
return self._icon_as_png_blob
# Nope, get it
try:
icon_blob = await self._icon.fetch_as_bytes()
input_buffer = io.BytesIO(icon_blob)