MCPcopy
hub / github.com/Sophomoresty/gemini-web2api / fetch_image_bytes

Function fetch_image_bytes

gemini_web2api/multimodal.py:119–127  ·  view source on GitHub ↗

Fetch image from URL.

(url: str)

Source from the content-addressed store, hash-verified

117
118
119def fetch_image_bytes(url: str) -> bytes:
120 """Fetch image from URL."""
121 try:
122 req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
123 resp = urllib.request.urlopen(req, timeout=30)
124 return resp.read()
125 except Exception as e:
126 log(f"Image fetch failed: {e}")
127 return b""

Callers 1

_upload_imagesFunction · 0.85

Calls 1

logFunction · 0.70

Tested by

no test coverage detected