diff --git a/margfools b/margfools index 759968e..0d4ca07 100755 --- a/margfools +++ b/margfools @@ -95,19 +95,20 @@ if __name__ == '__main__': request = json.loads(r.text) request['AuthenticationToken'] = token request['CertificatePublicKey'] = args.cert + # keep signing whatever they send us while True: for name in ('AttachmentHashes', 'XmlHashes'): if request.get(name) is not None: request[f'Signed{name}'] = [sign(e, args.key, pin, engine=args.engine) for e in request[name]] - d = json.dumps(request) - d = d.encode() + r = session.put(f'{url}signatures/{request["SignatureRequestId"]}', headers=headers | {'Content-Type': 'application/json; charset=utf-8'}, data=json.dumps(request).encode()) if not r.text: break request |= json.loads(r.text) + except Exception as ex: print(ex, file=sys.stderr) input('press enter to exit') # don’t close terminal immediately on fail