smarkets / smk_python_sdk

Smarkets Python SDK
http://smarkets.github.com/
MIT License
18 stars 11 forks source link

Can't instantiate more than one smarkets.clients.Smarkets #2

Closed r3m0t closed 11 years ago

r3m0t commented 11 years ago

If you have more than one client, their Callback objects are the same.

>>> import smarkets.clients
>>> a = smarkets.clients.Smarkets('_')
>>> b = smarkets.clients.Smarkets('_')
>>> def h(msg): print repr(("client a received", msg))
... 
>>> a.add_handler('seto.http_found', h)

# pretend b is connected and got a message...
>>> b.callbacks['seto.http_found']('example_message')
('client a received', 'example_message')