Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions pinecone/openapi_support/rest_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ def __init__(self, configuration: Configuration) -> None:
"Additional dependencies are required to use Pinecone with asyncio. Include these extra dependencies in your project by installing `pinecone[asyncio]`."
) from None

if configuration.ssl_ca_cert is not None:
ca_certs = configuration.ssl_ca_cert
if configuration.verify_ssl:
if configuration.ssl_ca_cert is not None:
ca_certs = configuration.ssl_ca_cert
else:
ca_certs = certifi.where()

ssl_context = ssl.create_default_context(cafile=ca_certs)
conn = aiohttp.TCPConnector(ssl=ssl_context)
else:
ca_certs = certifi.where()

ssl_context = ssl.create_default_context(cafile=ca_certs)

conn = aiohttp.TCPConnector(verify_ssl=configuration.verify_ssl, ssl=ssl_context)
conn = aiohttp.TCPConnector(verify_ssl=False)
Copy link

Choose a reason for hiding this comment

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

Deprecated verify_ssl used instead of ssl=False

Low Severity

The True branch uses the modern ssl parameter (ssl=ssl_context), but the False branch uses the deprecated verify_ssl=False parameter. Since the whole point of this PR is to stop mixing verify_ssl and ssl parameters (which are mutually exclusive since aiohttp 3.9.2), it would be more consistent and future-proof to use ssl=False instead of verify_ssl=False in the else branch. The verify_ssl parameter is deprecated in aiohttp in favor of ssl.

Fix in Cursor Fix in Web


if configuration.proxy:
self._session = aiohttp.ClientSession(connector=conn, proxy=configuration.proxy)
Expand Down