Send CoAP requests using Python

0 votes

Just like with HTTP requests, can I also send CoAP requests using Python? Here's what I tried and got many errors.

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

Oct 15, 2018 in IoT (Internet of Things) by Bharani
• 4,550 points
62 views
Also, I think the definition of the response.get() and its type could be wrong on my part. Please advice!

1 answer to this question.

0 votes

You can use 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 of type Response whose available methods are listed in this documentation so that you can easily build it yourself. Now, once you've done that, anything you want to do with the response, check for all available methods in the documentation and get the values that you want.

answered Oct 15, 2018 by nirvana
• 3,060 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer
0 votes
1 answer

Send LoRa measures to Fiware IOT agent via MQTT

down vote I dont know if I understood ...READ MORE

answered Jul 13, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
254 views
0 votes
1 answer

What is the size of CoAP packet?

It Depends: Core CoAP messages must be small enough ...READ MORE

answered Jul 17, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
86 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 135 views
0 votes
1 answer

Sending CoAP requests using Python

It can be done using a library ...READ MORE

answered Aug 24, 2018 in IoT (Internet of Things) by nirvana
• 3,060 points
288 views