我通过webhook接收以下格式的数据。你知道吗
{
"Body": "Test+131415+5%2B5%3D10",
"To": "whatsapp%3A%2B4915735992273",
"From": "whatsapp%3A%2B491603817902",
}
在Python中,我可以使用以下函数来转换数据。然而,我找不到一个方法节点.js得到同样的结果。你知道吗
def get_from(from: str) -> int:
"""
Replace %xx escapes by their single-character equivalent.
Only return the part that is behind the plus sign.
"""
receiver = unquote(receiver).split("+")
return receiver[1]
def get_body(body: str) -> str:
"""
Replace %xx escapes by their single-character equivalent.
_plus additionally replaces plus signs by spaces.
"""
body = unquote_plus(body)
return body
你知道吗urlib.parse.unquote文件nodejs中的等价项是unescape
没有等效的urlib.parse.unquote\u加号在nodejs中
但你可以自己做如下
相关问题 更多 >
编程相关推荐