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,660 points
2,639 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,130 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
3,833 views
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 25, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,322 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, 2019 in IoT (Internet of Things) by nirvana
• 3,130 points
2,140 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,454 views
0 votes
1 answer
0 votes
1 answer

Send CoAP requests using Python

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

answered Oct 16, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,870 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP