Sending CoAP requests using Python

0 votes

Just like sending an HTTP request, can I also send CoAP requests with Python? Although I got a lot of errors, this is how I tried to do it first:


rec = reuest.get(coap://localhost:5683/other/block)
 

Is there another way? Or am I missing something?

Aug 24, 2018 in IoT (Internet of Things) by Bharani
• 4,550 points
489 views

1 answer to this question.

0 votes

It can be done using a library like CoAPython as your CoAP client:

from coapthon.client.helperclient import HelperClient

client = HelperClient(server=('127.0.0.1', 5683))
response = client.get('other/block')
client.stop()

'response' is an instance of the type Response and its available methods are listed in the documentation, which you'll need to build.

Whatever you need to do with the response, just use the documentation to figure out its methods and get the desired results.

answered Aug 24, 2018 by nirvana
• 3,060 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer
0 votes
1 answer

Sending more than 8 byte through UART on Raspberry Pi using Android Things!

So, you can send 234212441325454543595674859764 in ASCII, ...READ MORE

answered Aug 24, 2018 in IoT (Internet of Things) by nirvana
• 3,060 points
138 views
0 votes
1 answer

Sending Web requests from my Web server to my IoT device

You need to start an HTTP server ...READ MORE

answered Jan 8 in IoT (Internet of Things) by nirvana
• 3,060 points
76 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 331 views
0 votes
1 answer

Send CoAP requests using Python

You can use a library like CoAPython ...READ MORE

answered Oct 15, 2018 in IoT (Internet of Things) by nirvana
• 3,060 points
110 views
0 votes
1 answer