[SOLVED] Is there a way to update the context values of a datasource via Python?

I am creating an app that needs to update the context of a Rasperry PI datasource to hold information there on certain statuses. I see how to create a datasource with the context set; however, I then cannot update the datasource with new context values. If I call with the create_datasource method included in the Ubidots Python client, it just makes an entirely new datasource in the dashboard. Any ideas how I can do this?

Thanks,

Mike

Hello @nchokie

Could you put your code here?

Not in the python library, but you can do with manually making a PATCH request:

PATCH things.ubidots.com/api/v1.6/datasources/57e1410576254251a1fc6759/?token=Tk5YVZ61CzAA02pV08Ht8jouKPoU8u

{"description":"Hello"}

Here’s a sample request in Postman:

In Ubidots the description is updated:

In Python there’s a library called requests that makes it simple to make a request like PATCH. See:


http://docs.python-requests.org/en/master/api/