From: Harmon Date: Wed, 29 Sep 2021 05:14:01 +0000 (-0500) Subject: Fix handling of strings as fields parameters for Client methods X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d61a5d9f52a9d9ee3f40d23515d6ffd1f2a02e14;p=tweepy.git Fix handling of strings as fields parameters for Client methods --- 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}")