从AngularJS POST访问JSON数据时发生Python错误
Python Error When Accessing JSON Data From AngularJS POST
我试图通过POST将数据发送到python脚本,但无法读取。UI在AngularJS中。我看到过类似的问题,但他们要么没有使用AngularJS,要么没有使用POST。
角度代码:
$scope.send = function(){
$data = {
"tableData":$scope.personsSelected
}
$postData = JSON.stringify($data);
Services.post('testbed.cgi', $postData);
}
Python代码:
formData = cgi.FieldStorage()
print json.dumps(formData)
错误消息:
TypeError: FieldStorage(None, None, []) is not JSON serializable
我曾尝试将内容类型设置为application/x-www-form-urlencoded,但没有成功。我在这里错过了什么?
问题在于您试图以JSON形式发送的数据。你想发送的数据是什么?它是Python对象吗?这可能会对你有所帮助。那些是普通的绳子吗?词典它们有无效字符吗?您可以使用JSON Lint来检查有效性。
相关文章:
- 使用.format在一些HTML代码中插入文本,会出现错误(Python)
- Python在尝试保存新的JSON文件时导致服务器错误
- Json在Python中出现var给定错误
- 对于Python,获取WebDriverException:消息:u'[JavaScript错误:“e为空”;
- 刷新Angular RouteProvider路由会导致Python出现404错误
- Esri 和 Python 之间的连接错误
- 在节点中运行 python 脚本.js语法错误
- Python - 从服务器获取数据 (ajax) - 'str' 对象不是可调用的错误
- Python Flask + 角度错误:“StoreController undefined”
- Selenium-Python 单击按钮总是返回错误
- Python Flask 应用程序,AJAX 帖子收到 400 个错误请求
- Python Pandas read_excel 和 to_json 日期格式错误
- 将 Python Flask JSON 字典导入 JavaScript 错误
- 在Python服务器上处理JSON对象会导致'列表'对象没有属性'读取'错误
- 从python向jquery返回ajax错误
- 从AngularJS POST访问JSON数据时发生Python错误
- Node.js安装python错误
- Python抓取网站得到Apache Tomcat/6.0.36 -错误报告
- 500(内部服务器错误)使用瓶子python和Angular JS
- 类型错误Ajax后Flask Python