diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-04-06 03:10:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-06 03:10:36 +0200 |
commit | 9d23ada968d7732317c8d851ba0c5f1295706f4c (patch) | |
tree | 60beaccf6b583663d75f9381cfc0395e4b1d3be6 /g4f/requests | |
parent | Merge pull request #1789 from hlohaus/free (diff) | |
parent | Fix unittests (diff) | |
download | gpt4free-9d23ada968d7732317c8d851ba0c5f1295706f4c.tar gpt4free-9d23ada968d7732317c8d851ba0c5f1295706f4c.tar.gz gpt4free-9d23ada968d7732317c8d851ba0c5f1295706f4c.tar.bz2 gpt4free-9d23ada968d7732317c8d851ba0c5f1295706f4c.tar.lz gpt4free-9d23ada968d7732317c8d851ba0c5f1295706f4c.tar.xz gpt4free-9d23ada968d7732317c8d851ba0c5f1295706f4c.tar.zst gpt4free-9d23ada968d7732317c8d851ba0c5f1295706f4c.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/requests/aiohttp.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/g4f/requests/aiohttp.py b/g4f/requests/aiohttp.py index 16b052eb..71e7bde7 100644 --- a/g4f/requests/aiohttp.py +++ b/g4f/requests/aiohttp.py @@ -15,11 +15,19 @@ class StreamResponse(ClientResponse): async for chunk in self.content.iter_any(): yield chunk - async def json(self) -> Any: - return await super().json(content_type=None) + async def json(self, content_type: str = None) -> Any: + return await super().json(content_type=content_type) class StreamSession(ClientSession): - def __init__(self, headers: dict = {}, timeout: int = None, proxies: dict = {}, impersonate = None, **kwargs): + def __init__( + self, + headers: dict = {}, + timeout: int = None, + connector: BaseConnector = None, + proxies: dict = {}, + impersonate = None, + **kwargs + ): if impersonate: headers = { **DEFAULT_HEADERS, @@ -29,7 +37,7 @@ class StreamSession(ClientSession): **kwargs, timeout=ClientTimeout(timeout) if timeout else None, response_class=StreamResponse, - connector=get_connector(kwargs.get("connector"), proxies.get("https")), + connector=get_connector(connector, proxies.get("all", proxies.get("https"))), headers=headers ) |