2023-06-01 03:50:56 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import argparse, json, sys
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument("action")
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
print("args:", args, file=sys.stderr, flush=True)
|
|
|
|
|
|
|
|
if args.action == "fetch":
|
2023-06-01 23:41:50 +00:00
|
|
|
print(json.dumps({
|
|
|
|
"id": "updateme",
|
|
|
|
"action": {
|
|
|
|
"increment": 1
|
|
|
|
}
|
|
|
|
}))
|
2023-06-01 03:50:56 +00:00
|
|
|
|
|
|
|
if args.action == "increment":
|
|
|
|
item = sys.stdin.readline()
|
|
|
|
item = json.loads(item)
|
2023-06-01 23:41:50 +00:00
|
|
|
item["action"]["increment"] += 1
|
2023-06-02 00:03:30 +00:00
|
|
|
item["body"] = f"<p>{item['action']['increment']}</p>"
|
2023-06-01 03:50:56 +00:00
|
|
|
print(json.dumps(item))
|
|
|
|
pass
|