Skip to content

Conversation

@Pierlou
Copy link
Contributor

@Pierlou Pierlou commented Sep 4, 2025

We could also retrieve/build file_name and mime from the URL's headers, but it sounds safer to ask the user to fill them in, idk 🤔

@Pierlou Pierlou requested a review from maudetes September 4, 2025 13:15
)
with self._client.session.stream("GET", file_to_upload) as streamed:
streamed.raise_for_status()
streamed.read()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the .read()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is apparently the syntax for httpx

raise ValueError(
"When uploading from a URL, file_name and mime arguments are required."
)
with self._client.session.stream("GET", file_to_upload) as streamed:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we open/close the session stream without a with context in order to mutualise the POST logic with just a different files dict?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants