Skip to content

TypeError: Invalid http_client argument. Unexpected keyword argument proxies #214

@marianobianchi

Description

@marianobianchi

I'm having an issue when trying to initialize the Retell client in python. This is a simple way to reproduce the error:

In [1]: from retell import Retell

In [2]: Retell(api_key=settings.RETELL_API_KEY)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[2], line 1
----> 1 Retell(api_key=settings.RETELL_API_KEY)

File ~/.local/lib/python3.12/site-packages/retell/_client.py:94, in Retell.__init__(self, api_key, base_url, timeout, max_retries, default_headers, default_query, http_client, _strict_response_validation)
     91 if base_url is None:
     92     base_url = f"https://api.retellai.com"
---> 94 super().__init__(
     95     version=__version__,
     96     base_url=base_url,
     97     max_retries=max_retries,
     98     timeout=timeout,
     99     http_client=http_client,
    100     custom_headers=default_headers,
    101     custom_query=default_query,
    102     _strict_response_validation=_strict_response_validation,
    103 )
    105 self.call = resources.CallResource(self)
    106 self.phone_number = resources.PhoneNumberResource(self)

File ~/.local/lib/python3.12/site-packages/retell/_base_client.py:855, in SyncAPIClient.__init__(self, version, base_url, max_retries, timeout, transport, proxies, limits, http_client, custom_headers, custom_query, _strict_response_validation)
    838     raise TypeError(
    839         f"Invalid `http_client` argument; Expected an instance of `httpx.Client` but got {type(http_client)}"
    840     )
    842 super().__init__(
    843     version=version,
    844     limits=limits,
   (...)
    853     _strict_response_validation=_strict_response_validation,
    854 )
--> 855 self._client = http_client or SyncHttpxClientWrapper(
    856     base_url=base_url,
    857     # cast to a valid type because mypy doesn't understand our type narrowing
    858     timeout=cast(Timeout, timeout),
    859     proxies=proxies,
    860     transport=transport,
    861     limits=limits,
    862     follow_redirects=True,
    863 )

File ~/.local/lib/python3.12/site-packages/retell/_base_client.py:753, in _DefaultHttpxClient.__init__(self, **kwargs)
    751 kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
    752 kwargs.setdefault("follow_redirects", True)
--> 753 super().__init__(**kwargs)

TypeError: Client.__init__() got an unexpected keyword argument 'proxies'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions