Permalink
Browse files

Renaming from Pachube to Cosm

As discussed in #8
  • Loading branch information...
1 parent 5c5adb2 commit 3c1ac38ac0fd7adf5b2be0a0bd3d4cd54b25af67 @petervizi committed May 14, 2012
Showing with 16 additions and 10 deletions.
  1. +1 −1 README.rst
  2. +11 −5 eeml/datastream.py
  3. +1 −1 example/read_serial.py
  4. +1 −1 example/simple_example.py
  5. +2 −2 tests/test_eeml.py
View
@@ -33,7 +33,7 @@ An example python script for publishing measurement data::
serial = serial.Serial('/dev/ttyUSB0', 9600)
readings = serial.readline().strip().split(' ') # the readings are separated by spaces
- pac = eeml.Pachube(API_URL, API_KEY)
+ pac = eeml.Cosm(API_URL, API_KEY)
pac.update([eeml.Data(0, readings[0], unit=eeml.Celsius()), eeml.Data(1, readings[1], unit=eeml.RH())])
pac.put()
View
@@ -8,17 +8,17 @@
__version__ = "0.1"
__docformat__ = "restructuredtext en"
__doc__ = """
-The way to handle data streams, and put it to the pachube server.
+The way to handle data streams, and put it to the Cosm server.
"""
url_pattern = re.compile("/v[12]/feeds/\d+\.xml")
-class Pachube(object):
+class Cosm(object):
"""
- A class for manually updating a pachube data stream.
+ A class for manually updating a Cosm data stream.
"""
- host = 'api.pachube.com'
+ host = 'api.cosm.com'
def __init__(self, url, key, env=None, loc=None, dat=[], use_https=True, timeout=10):
"""
@@ -67,7 +67,7 @@ def put(self):
else:
conn = httplib.HTTPConnection(self.host, timeout=self._http_timeout)
- conn.request('PUT', self._url, etree.tostring(self._eeml.toeeml(), encoding='UTF-8'), {'X-PachubeApiKey': self._key})
+ conn.request('PUT', self._url, etree.tostring(self._eeml.toeeml(), encoding='UTF-8'), {'X-ApiKey': self._key})
conn.sock.settimeout(5.0)
resp = conn.getresponse()
if resp.status != 200:
@@ -79,3 +79,9 @@ def put(self):
raise Exception(msg)
resp.read()
conn.close()
+
+class Pachube(Cosm):
+ """
+ For backward compatibility
+ """
+ pass
View
@@ -7,6 +7,6 @@
serial = serial.Serial('/dev/ttyUSB0', 9600)
readings = serial.readline().strip().split(' ') # the readings are separated by spaces
-pac = eeml.Pachube(API_URL, API_KEY)
+pac = eeml.Cosm(API_URL, API_KEY)
pac.update([eeml.Data(0, readings[0], unit=eeml.Celsius()), eeml.Data(1, readings[1], unit=eeml.RH())])
pac.put()
@@ -10,7 +10,7 @@
API_URL = 42166
readings = [3, 4]
-pac = eeml.Pachube(API_URL, API_KEY)
+pac = eeml.Cosm(API_URL, API_KEY)
pac.update([
eeml.Data("Temperature", readings[0], unit=eeml.Celsius()),
eeml.Data("Humidity", readings[1], unit=eeml.RH())])
View
@@ -55,7 +55,7 @@ def test_good_data(self):
def test_good_environment(self):
env = Environment('A Room Somewhere',
- 'http://www.pachube.com/feeds/1.xml',
+ 'http://www.cosm.com/feeds/1.xml',
'frozen',
'This is a room somewhere',
'http://www.roomsomewhere/icon.png',
@@ -79,7 +79,7 @@ def test_good_environment(self):
def test_good_create_doc(self):
env = Environment('A Room Somewhere',
- 'http://www.pachube.com/feeds/1.xml',
+ 'http://www.cosm.com/feeds/1.xml',
'frozen',
'This is a room somewhere',
'http://www.roomsomewhere/icon.png',

0 comments on commit 3c1ac38

Please sign in to comment.