Skip to content

Remove hardcoded trust_env value for RestClientObjectAsync #563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
antonioromero opened this issue Feb 22, 2023 · 2 comments · Fixed by #583
Closed

Remove hardcoded trust_env value for RestClientObjectAsync #563

antonioromero opened this issue Feb 22, 2023 · 2 comments · Fixed by #583
Assignees
Milestone

Comments

@antonioromero
Copy link

antonioromero commented Feb 22, 2023

This produces unexpected use of (for example) HTTP_PROXY.

Please take the argument "trust_env" away from here:

class RESTClientObjectAsync(object):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech
    Do not edit the class manually.
    """
   # ...
        # https pool manager
        _client_session_type = kwargs.get('client_session_type', aiohttp.ClientSession)
        _client_session_kwargs = kwargs.get('client_session_kwargs', {})
        self.pool_manager = _client_session_type(
            connector=connector,
            trust_env=True,
            timeout=timeout,
            trace_configs=[trace_config] if configuration.debug else None,
            **_client_session_kwargs
        )

Code from:

It could already be accesible via client_session_kwargs:

        InfluxDBClientAsync(
            url=url, token=token, org=org,
            client_session_kwargs={'trust_env': False},
        )

The problem is, that with the current configuration, it produces an exception:
TypeError: aiohttp.client.ClientSession() got multiple values for keyword argument 'trust_env'.

@antonioromero antonioromero changed the title Stop hardcoded trust_env value for RestClientObjectAsync Remove hardcoded trust_env value for RestClientObjectAsync Feb 22, 2023
@rashmi-bkk
Copy link

We have encountered a PermissionError while using InfluxDBClientAsync within our Django app, which is running within a Docker container.

The root cause of the issue is due to the trust_env setting, which forces the library to search for a proxy. This value is hardcoded and cannot be passed in client_session_kwargs. Attempting to pass this value results in a TypeError: aiohttp.client.ClientSession() got multiple values for keyword argument 'trust_env'.

As a temporary solution, we have applied a patch by setting client.api_client.rest_client.pool_manager._trust_env =False.
It would be nice if we could pass the trust_env value within client_session_kwargs.

@bednar
Copy link
Contributor

bednar commented Jun 20, 2023

Hi @antonioromero,

I have prepared a fixed version within #583. Development version of the client will be available after #583 acceptance, stable version in regular release cycle.

You could use a fixed version by:

pip install git+https://github.com/influxdata/influxdb-client-python.git@trust_env

Regards

@bednar bednar added this to the 1.35.0 milestone Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants