Skip to content

fix: fix DeprecationWarning in write API #419

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

Merged
merged 2 commits into from
Mar 16, 2022
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
1. [#405](https://github.com/influxdata/influxdb-client-python/pull/405): Add `InfluxLoggingHandler`. A handler to use the client in native python logging.
1. [#404](https://github.com/influxdata/influxdb-client-python/pull/404): Add `InvocableScriptsApi` to create, update, list, delete and invoke scripts by seamless way

### Bug Fixes
1. [#419](https://github.com/influxdata/influxdb-client-python/pull/419): Use `allowed_methods` to clear deprecation warning [urllib3]

### Dependencies
1. [#419](https://github.com/influxdata/influxdb-client-python/pull/419): Update dependencies:
- `urllib3` to 1.26.0

### CI
1. [#411](https://github.com/influxdata/influxdb-client-python/pull/411): Use new Codecov uploader for reporting code coverage

Expand Down
2 changes: 1 addition & 1 deletion influxdb_client/client/write_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def to_retry_strategy(self, **kwargs):
max_retry_time=self.max_retry_time / 1_000,
exponential_base=self.exponential_base,
retry_callback=kwargs.get("retry_callback", None),
method_whitelist=["POST"])
allowed_methods=["POST"])

def __getstate__(self):
"""Return a dict of attributes that you want to pickle."""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'six >= 1.10',
'python_dateutil >= 2.5.3',
'setuptools >= 21.0.0',
'urllib3 >= 1.15.1',
'urllib3 >= 1.26.0',
'pytz>=2019.1'
]

Expand Down
4 changes: 2 additions & 2 deletions tests/test_WriteOptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_default(self):
self.assertEqual(retry.max_retry_time, 180)
self.assertEqual(retry.max_retry_delay, 125)
self.assertEqual(retry.exponential_base, 2)
self.assertEqual(retry.method_whitelist, ["POST"])
self.assertEqual(retry.allowed_methods, ["POST"])

def test_custom(self):
retry = WriteOptions(max_retries=5, max_retry_delay=7500,
Expand All @@ -24,4 +24,4 @@ def test_custom(self):
self.assertEqual(retry.retry_interval, 0.5)
self.assertEqual(retry.max_retry_delay, 7.5)
self.assertEqual(retry.exponential_base, 2)
self.assertEqual(retry.method_whitelist, ["POST"])
self.assertEqual(retry.allowed_methods, ["POST"])
10 changes: 5 additions & 5 deletions tests/test_WritesRetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,27 +184,27 @@ def test_get_retry_after_jitter(self):
self.assertLessEqual(retry_after, 7)

def test_is_retry(self):
retry = WritesRetry(method_whitelist=["POST"])
retry = WritesRetry(allowed_methods=["POST"])

self.assertTrue(retry.is_retry("POST", 429, True))

def test_is_retry_428(self):
retry = WritesRetry(method_whitelist=["POST"])
retry = WritesRetry(allowed_methods=["POST"])

self.assertFalse(retry.is_retry("POST", 428, True))

def test_is_retry_430(self):
retry = WritesRetry(method_whitelist=["POST"])
retry = WritesRetry(allowed_methods=["POST"])

self.assertTrue(retry.is_retry("POST", 430, True))

def test_is_retry_retry_after_header_is_not_required(self):
retry = WritesRetry(method_whitelist=["POST"])
retry = WritesRetry(allowed_methods=["POST"])

self.assertTrue(retry.is_retry("POST", 429, False))

def test_is_retry_respect_method(self):
retry = WritesRetry(method_whitelist=["POST"])
retry = WritesRetry(allowed_methods=["POST"])

self.assertFalse(retry.is_retry("GET", 429, False))

Expand Down