Include unexpected parameters in Client request
authorHarmon <Harmon758@gmail.com>
Wed, 29 Sep 2021 05:19:17 +0000 (00:19 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 29 Sep 2021 05:20:12 +0000 (00:20 -0500)
tweepy/client.py

index eef9bda01897f4c06c4778b7b50b810afd2cf408..e3b445b6494e8ebdaea40fe7b17e2e1c2ad09cc3 100644 (file)
@@ -141,17 +141,17 @@ class Client:
             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))
-                elif param_name in ("start_time", "end_time") and isinstance(param_value, datetime.datetime):
-                    if param_value.tzinfo is not None:
-                        param_value = param_value.astimezone(datetime.timezone.utc)
-                    request_params[param_name] = param_value.strftime("%Y-%m-%dT%H:%M:%S.%fZ")
-                    # TODO: Constant datetime format string?
-                else:
-                    request_params[param_name] = param_value
+            if isinstance(param_value, list):
+                request_params[param_name] = ','.join(map(str, param_value))
+            elif param_name in ("start_time", "end_time") and isinstance(param_value, datetime.datetime):
+                if param_value.tzinfo is not None:
+                    param_value = param_value.astimezone(datetime.timezone.utc)
+                request_params[param_name] = param_value.strftime("%Y-%m-%dT%H:%M:%S.%fZ")
+                # TODO: Constant datetime format string?
             else:
+                request_params[param_name] = param_value
+
+            if param_name not in endpoint_parameters:
                 log.warn(f"Unexpected parameter: {param_name}")
 
         response = self.request(method, route, params=request_params,