#!/usr/bin/python import sys import requests session = requests.session () session.auth = ('schlatterbeck', 'xyzzy') url = 'http://bee:8080/ttt/rest/data/' # Delete status r = requests.get (url + 'status/1') if r.status_code != 200 : print ("ERROR: %s: %s\n %s" % (r.status_code, r.reason, r.text)) j = r.json () etag = j ['data']['@etag'] print (etag) d = { '@op': 'action', '@action_name': sys.argv [1] } r = requests.patch (url + 'status/1', headers = {'If-Match': etag}, json = d) if r.status_code != 200 : print ("ERROR: %s: %s\n %s" % (r.status_code, r.reason, r.text))