Skip to content

Commit

Permalink
add headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ywang96 committed Sep 18, 2024
1 parent 88bee5e commit 690937a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mistral_common/multimodal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
from pydantic import BeforeValidator, PlainSerializer, SerializationInfo
from typing_extensions import Annotated

from mistral_common import __version__

def download_image(url: str) -> Image.Image:
headers = {"User-Agent": f"mistral-common/{__version__}"}
try:
# Make a request to download the image
response = requests.get(url)
response = requests.get(url, headers=headers)
response.raise_for_status() # Raise an error for bad responses (4xx, 5xx)

# Convert the image content to a PIL Image
Expand Down

0 comments on commit 690937a

Please sign in to comment.