influxdata / influxdb-client-python

InfluxDB 2.0 python client
https://influxdb-client.readthedocs.io/en/stable/
MIT License
724 stars 187 forks source link

The batch item wasn't processed successfully because: __init__() got an unexpected keyword argument 'method_whitelist' #579

Closed ronytigo closed 1 year ago

ronytigo commented 1 year ago

Specifications

Code sample to reproduce problem

points = ['mes,item=4432,name=n val=-8i 1685395248425443, 'mes,item=4432,name=n val=-19i 1685395248434435']
rite_api.write('bucket', 'org', points, write_precision=WritePrecision.US)

Expected behavior

write to influxdb

Actual behavior

2023-05-29 21:20:49,555 - influxdb_client.client.write_api - ERROR - 539 - write_api.py - The batch item wasn't processed successfully because: init() got an unexpected keyword argument 'method_whitelist' 2023-05-29 21:20:49,556 - influxdb - ERROR - 84 - init.py - Cannot write batch: ...

Additional info

No response

powersj commented 1 year ago

Hi,

init() got an unexpected keyword argument 'method_whitelist'

This error generally means that you provided a keyword argument "method_whitelist" into a function, but that function does not know what to do with that argument. I did not see "method_whitelist" anywhere in the code.

Client Version: 1.24.0

This is pretty old, I would suggest updating to v1.36.0 in case this was an issue on a previous version.

ronytigo commented 1 year ago

it's on write_api.py:

   def to_retry_strategy(self, **kwargs):
        """
        Create a Retry strategy from write options.

        :key retry_callback: The callable ``callback`` to run after retryable error occurred.
                             The callable must accept one argument:
                                - `Exception`: an retryable error
        """
        return WritesRetry(
            total=self.max_retries,
            retry_interval=self.retry_interval / 1_000,
            jitter_interval=self.jitter_interval / 1_000,
            max_retry_delay=self.max_retry_delay / 1_000,
            max_retry_time=self.max_retry_time / 1_000,
            exponential_base=self.exponential_base,
            retry_callback=kwargs.get("retry_callback", None),
            method_whitelist=["POST"])

I'll try the newer version.