From b7eee50930dbd782d7c068d1d29cd270b97bc741 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Fri, 15 Mar 2024 14:55:53 +0100 Subject: Move raise_for_status, Create FormData wrapper --- g4f/Provider/You.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'g4f/Provider/You.py') diff --git a/g4f/Provider/You.py b/g4f/Provider/You.py index 8adc8b19..9b040367 100644 --- a/g4f/Provider/You.py +++ b/g4f/Provider/You.py @@ -5,7 +5,7 @@ import json import base64 import uuid try: - from curl_cffi import CurlMime + from ..requests.curl_cffi import FormData has_curl_cffi = True except ImportError: has_curl_cffi = False @@ -123,13 +123,11 @@ class You(AsyncGeneratorProvider, ProviderModelMixin): ) as response: await raise_for_status(response) upload_nonce = await response.text() - #data = FormData() - #data.add_field('file', file, filename=filename) - multipart = CurlMime() - multipart.addpart(name="file", filename=filename, data=file) + data = FormData() + data.add_field('file', file, filename=filename) async with client.post( f"{cls.url}/api/upload", - multipart=multipart, + data=data, headers={ "X-Upload-Nonce": upload_nonce, }, -- cgit v1.2.3