python-apps icon indicating copy to clipboard operation
python-apps copied to clipboard

Bug in http app

Open tristandostaler opened this issue 3 years ago • 1 comments

The bug is here: https://github.com/Shuffle/python-apps/blob/master/http/1.1.0/src/app.py#L102

When sending a string with ', it gets replace to ". This should not happen! What you are trying to do here is make sure the user is using " for the json payload over the key and values, but this is not necessary. See:

import json
import ast
json.dumps(ast.literal_eval("{'a':'b', \"b\":1}"))
# result: '{"a": "b", "b": 1}'

tristandostaler avatar Jan 26 '22 20:01 tristandostaler

The bug is here: https://github.com/Shuffle/python-apps/blob/master/http/1.1.0/src/app.py#L102

When sending a string with ', it gets replace to ". This should not happen! What you are trying to do here is make sure the user is using " for the json payload over the key and values, but this is not necessary. See:

import json
import ast
json.dumps(ast.literal_eval("{'a':'b', \"b\":1}"))
# result: '{"a": "b", "b": 1}'

ooh, this is a neat trick. Could probably get use for it in the SDK at some point, as we still do have some json parsing issues in very weird scenarios. Thanks!

frikky avatar Jan 26 '22 21:01 frikky