summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/PerplexityLabs.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-24 00:46:35 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-24 00:46:35 +0100
commit69ef224f92fcec3335a857305191678b886651e1 (patch)
treee2eb38fc678c68fa75b06631880172d164a9c7e7 /g4f/Provider/PerplexityLabs.py
parentAdd aiohttp_socks support (diff)
downloadgpt4free-69ef224f92fcec3335a857305191678b886651e1.tar
gpt4free-69ef224f92fcec3335a857305191678b886651e1.tar.gz
gpt4free-69ef224f92fcec3335a857305191678b886651e1.tar.bz2
gpt4free-69ef224f92fcec3335a857305191678b886651e1.tar.lz
gpt4free-69ef224f92fcec3335a857305191678b886651e1.tar.xz
gpt4free-69ef224f92fcec3335a857305191678b886651e1.tar.zst
gpt4free-69ef224f92fcec3335a857305191678b886651e1.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/PerplexityLabs.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/g4f/Provider/PerplexityLabs.py b/g4f/Provider/PerplexityLabs.py
index 9b11b708..5002b39f 100644
--- a/g4f/Provider/PerplexityLabs.py
+++ b/g4f/Provider/PerplexityLabs.py
@@ -6,6 +6,7 @@ from aiohttp import ClientSession, BaseConnector
from ..typing import AsyncResult, Messages
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
+from .helper import get_connector
API_URL = "https://labs-api.perplexity.ai/socket.io/"
WS_URL = "wss://labs-api.perplexity.ai/socket.io/"
@@ -48,13 +49,7 @@ class PerplexityLabs(AsyncGeneratorProvider, ProviderModelMixin):
"Sec-Fetch-Site": "same-site",
"TE": "trailers",
}
- if proxy and not connector:
- try:
- from aiohttp_socks import ProxyConnector
- connector = ProxyConnector.from_url(proxy)
- except ImportError:
- raise RuntimeError('Install "aiohttp_socks" package for proxy support')
- async with ClientSession(headers=headers, connector=connector) as session:
+ async with ClientSession(headers=headers, connector=get_connector(connector, proxy)) as session:
t = format(random.getrandbits(32), '08x')
async with session.get(
f"{API_URL}?EIO=4&transport=polling&t={t}",