Commits

Jason R. Coombs committed cc6b95d

Added thermostat module

  • Participants
  • Parent commits 728be47

Comments (0)

Files changed (2)

jaraco/home/thermostat.py

+import optparse
+import json
+import urlparse
+import urllib2
+from pprint import pprint
+
+thermostat = 'http://10.0.11.20'
+
+def request(path):
+	"""
+	Path is something like
+	/sys/info
+	/sys/network
+	/tstat/info
+	"""
+	url = urlparse.urljoin(thermostat, path)
+	req = urllib2.urlopen(url)
+	res = json.load(req)
+	return res
+
+def simple_request():
+	parser = optparse.OptionParser()
+	options, args = parser.parse_args()
+	path = args.pop(0)
+	pprint(request(path))
+
+	
 	packages=find_packages(),
 	namespace_packages=['jaraco'],
 	zip_safe=False,
+	entry_points = dict(
+		console_scripts=[
+			'thermostat=jaraco.home.thermostat:simple_request',
+			]
+		),
 	setup_requires=[
 		'hgtools',
 	],