Skip to content

Commit 0583314

Browse files
committed
Fix WebhookHandler.__get_args_count to enable to corp with functions with *args
1 parent e245518 commit 0583314

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

linebot/webhook.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,16 @@ def __add_handler(self, func, event, message=None):
267267

268268
@staticmethod
269269
def __get_args_count(func):
270+
HANDLER_ARGSIZE_MAXIMAM = 2
270271
if PY3:
271272
arg_spec = inspect.getfullargspec(func)
273+
if arg_spec.varargs is not None:
274+
return HANDLER_ARGSIZE_MAXIMAM
272275
return len(arg_spec.args)
273276
else:
274277
arg_spec = inspect.getargspec(func)
278+
if arg_spec.varargs is not None:
279+
return HANDLER_ARGSIZE_MAXIMAM
275280
return len(arg_spec.args)
276281

277282
@staticmethod

0 commit comments

Comments
 (0)