And here is my example on how i use it on Kivy
from kivy.network.urlrequest import UrlRequest
def patch_data (self, value, uuid):
host = '<your api server>'
endpoint = f'/switches/switches/{uuid}/'
url = host+endpoint
headers = { 'content-type': "application/json" }
body = {'value': value} # here if you want to use POST you need to send the entire object that you want to updata
body = json.dumps(body)
method = 'PATCH'
req = UrlRequest(url = url,
req_headers = headers,
req_body = body,
method = method,
on_success = self.req_response,
on_failure = self.req_failure)
# here you can implement more methods based on documentation
def req_response (self, req, result):
print(result)
def req_failure (self, req, result):
print (f'Failure is an option nowadays: {result}')
Hope it helps