Skip to content

Commit 8d464b5

Browse files
fix: catch blocksize typeError (#2499)
Catches error in init_poolmanager() and retries without blocksize param. Error: TypeError("SystemCertsAdapter.init_poolmanager() got an unexpected keyword argument 'blocksize'")
1 parent d442f95 commit 8d464b5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

python/langsmith/client.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,19 @@ def init_poolmanager(self, connections, maxsize, block=False, **pool_kwargs):
654654
if URLLIB3_SUPPORTS_BLOCKSIZE:
655655
# urllib3 before 2.0 doesn't support blocksize
656656
pool_kwargs["blocksize"] = self._blocksize
657-
return super().init_poolmanager(connections, maxsize, block, **pool_kwargs)
657+
try:
658+
return super().init_poolmanager(connections, maxsize, block, **pool_kwargs)
659+
except TypeError:
660+
if "blocksize" in pool_kwargs:
661+
logger.warning(
662+
"An intermediate HTTPAdapter does not accept the 'blocksize' "
663+
"kwarg. Retrying without it."
664+
)
665+
pool_kwargs.pop("blocksize")
666+
return super().init_poolmanager(
667+
connections, maxsize, block, **pool_kwargs
668+
)
669+
raise
658670

659671

660672
class ListThreadsItem(TypedDict):

0 commit comments

Comments
 (0)