Closed Aquafina-water-bottle closed 1 year ago
Looks good to me, let me know when this PR is ready.
Sorry for the delay, I was waiting for a different PR for a different project for another pair of eyes to verify the differences. I added some extra examples for when the action is version 6. It should be ready now! @FooSoft
Edit: forgot to mark as ready
The documentation for the
multi
action seems to be incorrect, so I updated it with the results that I got from the example code below.In particular, on successful calls, multi does not return entries in format
{"result": ..., "error": ...}
Example python code to generate the result
```python import json import urllib.request def request(action, **params): return {'action': action, 'params': params, 'version': 6} def invoke(action, **params): requestJson = json.dumps(request(action, **params)).encode('utf-8') response = json.load(urllib.request.urlopen(urllib.request.Request('http://localhost:8765', requestJson))) print(json.dumps(response)) if len(response) != 2: raise Exception('response has an unexpected number of fields') if 'error' not in response: raise Exception('response is missing required error field') if 'result' not in response: raise Exception('response is missing required result field') if response['error'] is not None: raise Exception(response['error']) return response['result'] invoke("multi", actions=[ {"action": "deckNames"}, {"action": "invalidAction", "params": {"useless": "param"}} ]) ```