Skip to content

Commit

Permalink
2024.6.1: Turn off cache when download
Browse files Browse the repository at this point in the history
Co-authored-by: chertvl <[email protected]>
  • Loading branch information
andrewjswan and chertvl committed Jun 9, 2024
1 parent d9925a6 commit b3a9b8c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions components/ehmtxv2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ def thumbnails(frames):
except Exception as e:
raise core.EsphomeError(f" ICONS: Could not load image file {path}: {e}")
else:
r = requests.get("https://developer.lametric.com/content/apps/icon_thumbs/" + conf[CONF_LAMEID], timeout=4.0)
r = requests.get("https://developer.lametric.com/content/apps/icon_thumbs/" + conf[CONF_LAMEID],
headers = {"Cache-Control": "no-cache, no-store, must-revalidate", "Pragma": "no-cache"},
timeout=4.0)
if r.status_code != requests.codes.ok:
raise core.EsphomeError(f" ICONS: Could not download image file {conf[CONF_LAMEID]}: {conf[CONF_ID]}")
image = Image.open(io.BytesIO(r.content))
Expand All @@ -400,7 +402,9 @@ def thumbnails(frames):
except Exception as e:
raise core.EsphomeError(f" ICONS: Could not load image file {path}: {e}")
else:
r = requests.get(conf[CONF_URL], timeout=4.0)
r = requests.get(conf[CONF_URL],
headers = {"Cache-Control": "no-cache, no-store, must-revalidate", "Pragma": "no-cache"},
timeout=4.0)
if r.status_code != requests.codes.ok:
raise core.EsphomeError(f" ICONS: Could not download image file {conf[CONF_URL]}: {conf[CONF_ID]}")
image = Image.open(io.BytesIO(r.content))
Expand Down

0 comments on commit b3a9b8c

Please sign in to comment.