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
245 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
77 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
21 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
56 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
56 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.