petervizi / python-eeml

A python package for generating eeml documents.
http://petervizi.github.com/python-eeml
GNU General Public License v3.0
43 stars 11 forks source link

reading ID can be a string (at least on cosm.com) #27

Open petrklus opened 11 years ago

petrklus commented 11 years ago

Hi, First of all - thank for your excellent library!

I am using it to publish some temperatures from my home automation system, however, I had to resort to a rather dirty hack to enable string in identifiers:

pac = eeml.datastream.Cosm(API_URL, API_KEY)

fridge_temp = eeml.Data(0, 4.2, unit=eeml.unit.Celsius())
fridge_temp._id = "fridge_temp" #overriding the check for integer

freezer_temp = eeml.Data(0, -22.2, unit=eeml.unit.Celsius())
freezer_temp._id = "freezer_temp"
pac.update([fridge_temp])
pac.update([freezer_temp])
pac.put()

As I like things robust, I would prefer it it all worked even after you update and change some of the internals...

Here is an example of my aforementioned setup, where all works as it should! image

petervizi commented 11 years ago

Hey petrklus, please refer to issue #24 for a detailed discussion, and the test_invalidator test case in tests/test_eeml.py on how to use the Invalidator.