From 8cc6000ffbf4e12bf6c1d5e5878d376e36857ec0 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Fri, 15 Mar 2024 11:46:06 +0100 Subject: Add Pyinstaller support, Use curl_cffi in You provider --- g4f/requests/aiohttp.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'g4f/requests/aiohttp.py') diff --git a/g4f/requests/aiohttp.py b/g4f/requests/aiohttp.py index 6979b20a..505086a1 100644 --- a/g4f/requests/aiohttp.py +++ b/g4f/requests/aiohttp.py @@ -1,6 +1,6 @@ from __future__ import annotations -from aiohttp import ClientSession, ClientResponse, ClientTimeout, BaseConnector +from aiohttp import ClientSession, ClientResponse, ClientTimeout, BaseConnector, FormData from typing import AsyncIterator, Any, Optional from .defaults import DEFAULT_HEADERS @@ -43,4 +43,8 @@ def get_connector(connector: BaseConnector = None, proxy: str = None, rdns: bool connector = ProxyConnector.from_url(proxy, rdns=rdns) except ImportError: raise MissingRequirementsError('Install "aiohttp_socks" package for proxy support') - return connector \ No newline at end of file + return connector + +class CurlMime(FormData): + def addpart(self, name: str, content_type: str = None, filename: str = None, data: bytes = None): + self.add_field(name, data, content_type=content_type, filename=filename) \ No newline at end of file -- cgit v1.2.3 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/requests/aiohttp.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'g4f/requests/aiohttp.py') diff --git a/g4f/requests/aiohttp.py b/g4f/requests/aiohttp.py index 505086a1..16b052eb 100644 --- a/g4f/requests/aiohttp.py +++ b/g4f/requests/aiohttp.py @@ -43,8 +43,4 @@ def get_connector(connector: BaseConnector = None, proxy: str = None, rdns: bool connector = ProxyConnector.from_url(proxy, rdns=rdns) except ImportError: raise MissingRequirementsError('Install "aiohttp_socks" package for proxy support') - return connector - -class CurlMime(FormData): - def addpart(self, name: str, content_type: str = None, filename: str = None, data: bytes = None): - self.add_field(name, data, content_type=content_type, filename=filename) \ No newline at end of file + return connector \ No newline at end of file -- cgit v1.2.3