我在Alfresco和Python中遇到了一个问题:我想用Python直接上传一个新文件。每次我尝试我都会得到一个没有细节的http500错误。。。在
我首先尝试使用CURL,以确保它能正常工作,并且文件上传时没有问题。在
我使用了以下curl命令行:
url -X POST -uadmin:admin "http://localhost:8080/alfresco/service/api/upload" -F filedata=@/tmp/eeeeee.pdf -F siteid=test -F containerid=documentLibrary
在Python脚本中,我尝试了PyCurl,现在尝试了简单的urllib。我认为问题出在文件作为参数的方式。在
使用PyCurl的Python代码:
^{pr2}$此代码示例将导致:
{
"code" : 500,
"name" : "Internal Error",
"description" : "An error inside the HTTP server which prevented it from fulfilling the request."
},
"message" : "04200017 Unexpected error occurred during upload of new content."
有人知道怎么做到吗?在
您可以使用非常简单的库Requests。在
输出:
^{pr2}$相关问题 更多 >
编程相关推荐