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

Cannot post temp value #18

Closed andig closed 11 years ago

andig commented 11 years ago

I'm trying to post a simple °C value to cosm:

pac.update([eeml.Data("Pi Temp", value=temp, at=datetime.datetime.utcnow(), minValue=0, maxValue=None, unit=eeml.Celsius())])
print(pac.geteeml())
pac.put()

This is the xml- potentially with an encoding issue:

<eeml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.eeml.org/xsd/0.5.1" xsi:schemaLocation="http://www.eeml.org/xsd/0.5.1 http://www.eeml.org/xsd/0.5.1/0.5.1.xsd" version="0.5.1">
  <environment>
    <location>
      <lat>52.28336</lat>
      <lon>9.83735</lon>
    </location>
    <data id="Pi Temp">
      <current_value minValue="0" at="2012-12-13T08:45:11.317000">42.5</current_value>
      <unit type="derivedSI" symbol="°C">Celsius</unit>
    </data>
  </environment>
</eeml>

And this is the error raised:

Traceback (most recent call last):
  File "C:\data\workspace\RaspberryPi\pitempmon.py", line 21, in <module>
pac.put()
  File "C:\Python27\lib\site-packages\python_eeml-2.0.0-py2.7.egg\eeml\datastream.py", line 74, in put
raise CosmError(msg)
eeml.datastream.CosmError: Unprocessable Entity: Stream is invalid
andig commented 11 years ago

My mistake- data id must not contain spaces- sorry.