In [1]: from streammachine.driver import StreamMachineClient
...:
In [2]: client = StreamMachineClient("anne.schuth", "e4e2iwr7k0hu393lfiwz2gnc2m1wk6", "******************************")
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-4492438d88c4> in <module>
----> 1 client = StreamMachineClient("anne.schuth", "e4e2iwr7k0hu393lfiwz2gnc2m1wk6", "******************************")
TypeError: __init__() missing 1 required positional argument: 'config'
StreamMachineClient
?
Have a look at this line in the example on Github: https://github.com/streammachineio/python-examples/blob/master/examples/sender.py#L22
You're missing the ClientConfig
. You can initialize the ClientConfig
as follows: ClientConfig()
, which will use all default values.
.
from my billing_id (at least, the topic name doesn't contain it anymore). I'm now getting this error: In [8]: client = StreamMachineClient("anne.schuth", "6f9j2xysgwiec6pwgrzjpeqxd0q55d", "******************************", ClientConfig())
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-8-96a037c09203> in <module>
----> 1 client = StreamMachineClient("anne.schuth", "6f9j2xysgwiec6pwgrzjpeqxd0q55d", "******************************", ClientConfig())
~/.pyenv/versions/3.8.5/lib/python3.8/site-packages/streammachine/driver/client/client.py in __init__(self, billing_id, client_id, client_secret, config)
19 :param config: internal configuration (only change if instructed)
20 """
---> 21 self._sender_service = SenderService(billing_id, client_id, client_secret, config)
22 self._receiver_service = ReceiverService(billing_id, client_id, client_secret, config)
23
~/.pyenv/versions/3.8.5/lib/python3.8/site-packages/streammachine/driver/client/sender.py in __init__(self, billing_id, client_id, client_secret, config)
10 self._logger = config.get_logger(__name__)
11
---> 12 self.auth_service = AuthService(
13 purpose=self.__class__.__name__,
14 billing_id=billing_id,
~/.pyenv/versions/3.8.5/lib/python3.8/site-packages/streammachine/driver/client/auth.py in __init__(self, purpose, billing_id, client_id, client_secret, config)
31
32 self.auth_provider: AuthProvider = None
---> 33 self.timer_task = TimerTask(self._initialize_auth_provider, config.sts_refresh_interval)
34
35 async def start(self):
~/.pyenv/versions/3.8.5/lib/python3.8/site-packages/streammachine/driver/util/__init__.py in __init__(self, method, time_in_seconds)
21 self._task = None
22
---> 23 self.method()
24
25 async def start(self):
~/.pyenv/versions/3.8.5/lib/python3.8/site-packages/streammachine/driver/client/auth.py in _initialize_auth_provider(self)
76 if self.auth_provider is None:
77 self._logger.debug(f"Initializing a new Auth Provider for {self._purpose}")
---> 78 self._authenticate(self._billing_id, self._client_id, self._client_secret)
79 elif self.auth_provider.is_almost_expired():
80 self._logger.debug(f"Refreshing an existing Auth Provider {self._purpose}")
~/.pyenv/versions/3.8.5/lib/python3.8/site-packages/streammachine/driver/client/auth.py in _authenticate(self, billing_id, client_id, client_secret)
43 try:
44 payload = AuthRequest(billing_id, client_id, client_secret)
---> 45 self._do_post(self._config.sts_auth_uri, payload)
46 except HTTPError as e:
47 self._logger.error(
~/.pyenv/versions/3.8.5/lib/python3.8/site-packages/streammachine/driver/client/auth.py in _do_post(self, uri, payload)
65 try:
66 response = requests.post(uri, headers=AuthService._headers, data=payload.to_json())
---> 67 self.auth_provider = AuthProvider.from_json(response.json())
68 except HTTPError as e:
69 self._logger.error(e)
~/.pyenv/versions/3.8.5/lib/python3.8/site-packages/streammachine/driver/client/auth.py in from_json(json_dict)
92 @staticmethod
93 def from_json(json_dict: dict) -> 'AuthProvider':
---> 94 return JsonSerializable._from_json(json_dict, AuthProvider)
95
96 def is_almost_expired(self):
~/.pyenv/versions/3.8.5/lib/python3.8/site-packages/streammachine/driver/domain/base.py in _from_json(json_dict, clazz)
6 @staticmethod
7 def _from_json(json_dict: Dict, clazz):
----> 8 return clazz(**JsonSerializable._to_snake_case(json_dict))
9
10 def to_json(self):
TypeError: __init__() got an unexpected keyword argument 'error'
@
0.0.1
(GET https://out.strm.services/is-alive) 200