From d61a5d9f52a9d9ee3f40d23515d6ffd1f2a02e14 Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 29 Sep 2021 00:14:01 -0500 Subject: [PATCH] Fix handling of strings as fields parameters for Client methods --- tweepy/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tweepy/client.py b/tweepy/client.py index 53ad74b..eef9bda 100644 --- a/tweepy/client.py +++ b/tweepy/client.py @@ -138,6 +138,9 @@ class Client: json=None, data_type=None, user_auth=False): request_params = {} for param_name, param_value in params.items(): + if param_name.replace('_', '.') in endpoint_parameters: + param_name = param_name.replace('_', '.') + if param_name in endpoint_parameters: if isinstance(param_value, list): request_params[param_name] = ','.join(map(str, param_value)) @@ -148,9 +151,6 @@ class Client: # TODO: Constant datetime format string? else: request_params[param_name] = param_value - elif param_name.replace('_', '.') in endpoint_parameters: - # Use := when support for Python 3.7 is dropped - request_params[param_name.replace('_', '.')] = ','.join(param_value) else: log.warn(f"Unexpected parameter: {param_name}") -- 2.25.1