smarkets / smk_python_sdk

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

Fix multiple Smarkets instances #3

Closed r3m0t closed 11 years ago

r3m0t commented 12 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')
jstasiak commented 11 years ago

Thank you for the patch, just I merged it manually because of some other changes in master branch. Sorry about the delay (we missed this pull request, we're gonna pay more attention to our GitHub repositories).