1- ![ build status] ( https://travis-ci.org/devicehive/devicehive-python.svg?branch=stable )
1+ [ ![ License] ( https://img.shields.io/badge/License-Apache%202.0-blue.svg )] ( LICENSE )
2+ [ ![ PyPI] ( https://img.shields.io/pypi/v/devicehive.svg )] ( https://pypi.python.org/pypi/devicehive )
3+ [ ![ Build Status] ( https://travis-ci.org/devicehive/devicehive-python.svg?branch=master )] ( https://travis-ci.org/devicehive/devicehive-python )
24
35# Devicehive
46
@@ -18,7 +20,7 @@ Example:
1820from devicehive import DeviceHiveApi
1921
2022
21- url = ' http://playground-dev .devicehive.com/api/rest'
23+ url = ' http://playground.devicehive.com/api/rest'
2224refresh_token = ' SOME_REFRESH_TOKEN'
2325device_hive_api = DeviceHiveApi(url, refresh_token = refresh_token)
2426```
@@ -28,7 +30,7 @@ device_hive_api = DeviceHiveApi(url, refresh_token=refresh_token)
2830If you want to use ` Websocket ` protocol you need only to specify the url:
2931
3032``` python
31- url = ' ws://playground-dev .devicehive.com/api/websocket'
33+ url = ' ws://playground.devicehive.com/api/websocket'
3234```
3335
3436### Authentication
@@ -45,23 +47,23 @@ Examples:
4547from devicehive import DeviceHiveApi
4648
4749
48- url = ' ws://playground-dev .devicehive.com/api/websocket'
50+ url = ' ws://playground.devicehive.com/api/websocket'
4951device_hive_api = DeviceHiveApi(url, refresh_token = ' SOME_REFRESH_TOKEN' )
5052```
5153
5254``` python
5355from devicehive import DeviceHiveApi
5456
5557
56- url = ' ws://playground-dev .devicehive.com/api/websocket'
58+ url = ' ws://playground.devicehive.com/api/websocket'
5759device_hive_api = DeviceHiveApi(url, access_token = ' SOME_ACCESS_TOKEN' )
5860```
5961
6062``` python
6163from devicehive import DeviceHiveApi
6264
6365
64- url = ' ws://playground-dev .devicehive.com/api/websocket'
66+ url = ' ws://playground.devicehive.com/api/websocket'
6567device_hive_api = DeviceHiveApi(url, login = ' SOME_LOGIN' , password = ' SOME_PASSWORD' )
6668```
6769
@@ -85,7 +87,7 @@ Example:
8587from devicehive import DeviceHiveApi
8688
8789
88- url = ' http://playground-dev .devicehive.com/api/rest'
90+ url = ' http://playground.devicehive.com/api/rest'
8991refresh_token = ' SOME_REFRESH_TOKEN'
9092device_hive_api = DeviceHiveApi(url, refresh_token = refresh_token)
9193info = device_hive_api.get_info()
@@ -112,7 +114,7 @@ Example:
112114from devicehive import DeviceHiveApi
113115
114116
115- url = ' http://playground-dev .devicehive.com/api/rest'
117+ url = ' http://playground.devicehive.com/api/rest'
116118refresh_token = ' SOME_REFRESH_TOKEN'
117119device_hive_api = DeviceHiveApi(url, refresh_token = refresh_token)
118120name = ' user.login.lastTimeoutSent'
@@ -141,7 +143,7 @@ Example:
141143from devicehive import DeviceHiveApi
142144
143145
144- url = ' http://playground-dev .devicehive.com/api/rest'
146+ url = ' http://playground.devicehive.com/api/rest'
145147refresh_token = ' SOME_REFRESH_TOKEN'
146148device_hive_api = DeviceHiveApi(url, refresh_token = refresh_token)
147149tokens = device_hive_api.create_token(1 )
@@ -159,6 +161,18 @@ objects. All args are optional.
159161
160162` put_device(device_id, name, data, network_id, is_blocked) ` method returns ` Device ` object. Only ` device_id ` is required.
161163
164+ ` list_commands(device_id, start, end, command, status, sort_field, sort_order, take, skip) ` method returns list of ` Command `
165+ objects. Only ` device_id ` is required.
166+
167+ ` send_command(device_id, command_name, parameters, lifetime, timestamp, status, result) ` method returns ` Command ` object.
168+ Only ` device_id ` and ` command_name ` are required.
169+
170+ ` list_notifications(device_id, start, end, notification, sort_field, sort_order, take, skip) ` method returns list of ` Notification `
171+ object. Only ` device_id ` is required.
172+
173+ ` send_notification(device_id, notification_name, parameters, timestamp) ` method returns ` Notification ` object.
174+ Only ` device_id ` and ` notification_name ` are required.
175+
162176#### Device object
163177
164178Properties:
@@ -213,7 +227,7 @@ Example:
213227from devicehive import DeviceHiveApi
214228
215229
216- url = ' http://playground-dev .devicehive.com/api/rest'
230+ url = ' http://playground.devicehive.com/api/rest'
217231refresh_token = ' SOME_REFRESH_TOKEN'
218232device_hive_api = DeviceHiveApi(url, refresh_token = refresh_token)
219233device_id = ' example-device'
@@ -247,15 +261,15 @@ Properties:
247261Methods:
248262
249263* ` save() ` method does not return anything.
250- * ` remove() ` method does not return anything.
264+ * ` remove(force ) ` method does not return anything. All args are optional .
251265
252266Example:
253267
254268``` python
255269from devicehive import DeviceHiveApi
256270
257271
258- url = ' http://playground-dev .devicehive.com/api/rest'
272+ url = ' http://playground.devicehive.com/api/rest'
259273refresh_token = ' SOME_REFRESH_TOKEN'
260274device_hive_api = DeviceHiveApi(url, refresh_token = refresh_token)
261275network_name = ' example-name'
@@ -283,15 +297,15 @@ Properties:
283297Methods:
284298
285299* ` save() ` method does not return anything.
286- * ` remove() ` method does not return anything.
300+ * ` remove(force ) ` method does not return anything. All args are optional .
287301
288302Example:
289303
290304``` python
291305from devicehive import DeviceHiveApi
292306
293307
294- url = ' http://playground-dev .devicehive.com/api/rest'
308+ url = ' http://playground.devicehive.com/api/rest'
295309refresh_token = ' SOME_REFRESH_TOKEN'
296310device_hive_api = DeviceHiveApi(url, refresh_token = refresh_token)
297311device_type_name = ' example-name'
@@ -345,7 +359,7 @@ from devicehive import DeviceHiveApi
345359from devicehive.user import User
346360
347361
348- url = ' http://playground-dev .devicehive.com/api/rest'
362+ url = ' http://playground.devicehive.com/api/rest'
349363refresh_token = ' SOME_REFRESH_TOKEN'
350364device_hive_api = DeviceHiveApi(url, refresh_token = refresh_token)
351365login = ' example-login'
@@ -434,7 +448,7 @@ class SimpleHandler(Handler):
434448 print (notification.notification)
435449
436450
437- url = ' http://playground-dev .devicehive.com/api/rest'
451+ url = ' http://playground.devicehive.com/api/rest'
438452refresh_token = ' SOME_REFRESH_TOKEN'
439453dh = DeviceHive(SimpleHandler)
440454dh.connect(url, refresh_token = refresh_token)
@@ -469,7 +483,7 @@ device_hive = DeviceHive(SimpleHandler, 'some_arg', some_kwarg='some_kwarg')
469483If you want to use ` Websocket ` protocol you need only to specify the url:
470484
471485``` python
472- url = ' ws://playground-dev .devicehive.com/api/websocket'
486+ url = ' ws://playground.devicehive.com/api/websocket'
473487```
474488
475489### Authentication
@@ -483,17 +497,17 @@ There are three ways of initial authentication:
483497Examples:
484498
485499``` python
486- url = ' ws://playground-dev .devicehive.com/api/websocket'
500+ url = ' ws://playground.devicehive.com/api/websocket'
487501device_hive.connect(url, refresh_token = ' SOME_REFRESH_TOKEN' )
488502```
489503
490504``` python
491- url = ' ws://playground-dev .devicehive.com/api/websocket'
505+ url = ' ws://playground.devicehive.com/api/websocket'
492506device_hive.connect(url, access_token = ' SOME_ACCESS_TOKEN' )
493507```
494508
495509``` python
496- url = ' ws://playground-dev .devicehive.com/api/websocket'
510+ url = ' ws://playground.devicehive.com/api/websocket'
497511device_hive.connect(url, login = ' SOME_LOGIN' , password = ' SOME_PASSWORD' )
498512```
499513
@@ -671,6 +685,18 @@ class SimpleHandler(Handler):
671685
672686` self.api.put_device(device_id, name, data, network_id, device_type_id, is_blocked) ` method does not return anything. ` put_device ` method of ` DeviceHiveApi ` class is the wrapper on top of this call.
673687
688+ ` self.api.list_commands(device_id, start, end, command, status, sort_field, sort_order, take, skip) ` method returns list of ` Command `
689+ objects. ` list_commands ` method of ` DeviceHiveApi ` class is the wrapper on top of this call.
690+
691+ ` self.api.send_command(device_id, command_name, parameters, lifetime, timestamp, status, result) ` method returns ` Command ` object.
692+ ` send_command ` method of ` DeviceHiveApi ` class is the wrapper on top of this call.
693+
694+ ` self.api.list_notifications(device_id, start, end, notification, sort_field, sort_order, take, skip) ` method returns list of ` Notification `
695+ objects. ` list_notifications ` method of ` DeviceHiveApi ` class is the wrapper on top of this call.
696+
697+ ` self.api.send_notification(device_id, notification_name, parameters, timestamp) ` method returns ` Notification ` object.
698+ ` send_notification ` method of ` DeviceHiveApi ` class is the wrapper on top of this call.
699+
674700See the description of ` DeviceHiveApi ` [ device] ( #devices ) methods for more details.
675701
676702#### API device object
@@ -864,7 +890,7 @@ class ReceiverHandler(Handler):
864890 print (' Notification "%s " received' % notification.notification)
865891
866892
867- url = ' ws://playground-dev .devicehive.com/api/websocket'
893+ url = ' ws://playground.devicehive.com/api/websocket'
868894refresh_token = ' SOME_REFRESH_TOKEN'
869895dh = DeviceHive(ReceiverHandler)
870896dh.connect(url, refresh_token = refresh_token)
@@ -907,7 +933,7 @@ class SenderHandler(Handler):
907933 self ._send_notifications()
908934
909935
910- url = ' http://playground-dev .devicehive.com/api/rest'
936+ url = ' http://playground.devicehive.com/api/rest'
911937refresh_token = ' SOME_REFRESH_TOKEN'
912938dh = DeviceHive(SenderHandler)
913939dh.connect(url, refresh_token = refresh_token)
0 commit comments