Fixes param issues with AWS SNS SQS transport
@@ -9,6 +9,7 @@ import re
import binascii
import ujson
import uuid
+import inspect
from typing import Any, Dict, Union, Optional, Callable, Awaitable, List, Tuple, Match
from tomodachi.invoker import Invoker
@@ -92,7 +93,8 @@ class AWSSNSSQSTransport(Invoker):
_callback_kwargs = callback_kwargs # type: Any
if not _callback_kwargs:
- _callback_kwargs = {k: func.__defaults__[len(func.__defaults__) - len(func.__code__.co_varnames[1:]) + i] if func.__defaults__ and len(func.__defaults__) - len(func.__code__.co_varnames[1:]) + i >= 0 else None for i, k in enumerate(func.__code__.co_varnames[1:])}
+ values = inspect.getfullargspec(func)
+ _callback_kwargs = {k: values.defaults[i - len(values.args) + 1] if values.defaults and i >= len(values.args) - len(values.defaults) - 1 else None for i, k in enumerate(values.args[1:])} if values.args and len(values.args) > 1 else {}
else:
_callback_kwargs = {k: None for k in _callback_kwargs if k != 'self'}
kwargs = {k: v for k, v in _callback_kwargs.items()}
