mirror of
https://github.com/OpenMTC/OpenMTC.git
synced 2025-06-15 05:08:07 +00:00
Test debian stretch+python3 (#18)
* changes starting with python3 explicit * removes python modules which are not available for python3 * exchanges fyzz query parsing with rdflib functionality * fixes interop tests * replaces reduce with for loop in nodb driver * simple python2 -> python3 conversions * adds changes for handling different string handling in python3 * test stretch building with travis * installing python-setuptools in docker * installing python-setuptools in docker * changing python2 to python3 in docker makefiles * changing python2 to python3 and some other test changes * push docker only in master branche * running version of openmtc * fix some port problems * porting path library completly now * restoring travis.yml * testing new travis.yml * add sudo * updating travis OS from trusty to xenial * upgrade pip before * show running docker logs * show more logs * for debugging * showlogs of docker after failure * testing new travis.yml * finish travis.yml
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
|
||||
import urllib
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
import urllib.error
|
||||
from openmtc_app.onem2m import XAE
|
||||
import uuid
|
||||
|
||||
@ -15,9 +17,9 @@ class DataVisualization(XAE):
|
||||
self.sensor_register = []
|
||||
self.sensor_values = []
|
||||
self.name = uuid.uuid1()
|
||||
self.things_name = urllib.urlopen("https://dweet.io/follow/%s" % self.name)
|
||||
print "Thing name :", self.name
|
||||
print "link for the current data type and values :", self.things_name.geturl()
|
||||
self.things_name = urllib.request.urlopen("https://dweet.io/follow/%s" % self.name)
|
||||
print("Thing name :", self.name)
|
||||
print("link for the current data type and values :", self.things_name.geturl())
|
||||
# start endless loop
|
||||
self.periodic_discover(self.remote_cse,
|
||||
{'labels': ["openmtc:sensor_data"]},
|
||||
@ -28,13 +30,13 @@ class DataVisualization(XAE):
|
||||
self.add_container_subscription(uri, self.handle_sensor_data)
|
||||
|
||||
def handle_sensor_data(self, container, content):
|
||||
data ={}
|
||||
data = {}
|
||||
self.sensor_register.append(content[0]['n'])
|
||||
self.sensor_values.append(content[0]['v'])
|
||||
for i, k in zip(self.sensor_register , self.sensor_values):
|
||||
for i, k in zip(self.sensor_register, self.sensor_values):
|
||||
data.update({i: k})
|
||||
params = urllib.urlencode(data)
|
||||
urllib.urlopen("https://dweet.io/dweet/for/%s?%s" % (self.name, params))
|
||||
params = urllib.parse.urlencode(data)
|
||||
urllib.request.urlopen("https://dweet.io/dweet/for/%s?%s" % (self.name, params))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Reference in New Issue
Block a user