summaryrefslogtreecommitdiffstats
path: root/examples/clients/coap-client.py
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2013-12-25 13:25:16 +0100
committermanuel <manuel@mausz.at>2013-12-25 13:25:16 +0100
commit0c8c9ad976879f7c90f9915a60845ccb0cdb337d (patch)
tree162951b4713f3836f4114958a423e2c90ecf9c6b /examples/clients/coap-client.py
downloadwebiopi-0c8c9ad976879f7c90f9915a60845ccb0cdb337d.tar.gz
webiopi-0c8c9ad976879f7c90f9915a60845ccb0cdb337d.tar.bz2
webiopi-0c8c9ad976879f7c90f9915a60845ccb0cdb337d.zip
initial commit
Diffstat (limited to 'examples/clients/coap-client.py')
-rw-r--r--examples/clients/coap-client.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/clients/coap-client.py b/examples/clients/coap-client.py
new file mode 100644
index 0000000..eba80e9
--- /dev/null
+++ b/examples/clients/coap-client.py
@@ -0,0 +1,15 @@
1from webiopi.protocols.coap import *
2from time import sleep
3
4client = COAPClient()
5client.sendRequest(COAPPost("coap://224.0.1.123/GPIO/25/function/out"))
6state = True
7
8while True:
9 response = client.sendRequest(COAPPost("coap://224.0.1.123/GPIO/25/value/%d" % state))
10 if response:
11 print("Received response:\n%s" % response)
12 state = not state
13 else:
14 print("No response received")
15 sleep(0.5)