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,580 points
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=('', 5683))
response = client.get('other/block')

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,120 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer

Azure IoT Hub : Sending messages using Python via mqtt

The thing is that IoT Hub is not ...READ MORE

answered Jan 4, 2019 in IoT (Internet of Things) by Upasana
• 8,620 points
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,280 points
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,280 points
+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, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,371 views
0 votes
0 answers
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,120 points