我试图执行这个post
,但是我得到了server error 500
:
import requests
base_url = "https://www.assurland.com/ws/CarVehiculeSearch.asmx"
url = "%s/%s"% (base_url,"GetCarBodyTypeListByCarAlim")
pars ={"CarAlim":"DIES","CarType": "A7", "CodeMake": "AUDI", "FirstDrivingDate": "2015-09-22"}
with requests.Session() as s:
r = s.post(url,data=pars)
print r.status_code
## 500
我想我需要做些饼干或其他的东西。在
提前谢谢你的帮助。在
该站点上的大多数API访问点似乎已损坏。你的代码本身没有问题。实际上,即使使用常规浏览器,我也无法让网站在自己的web界面中对任何请求做出响应。在
您还可以使用SOAP protocol创建查询的main API documentation详细信息(法语);Python有{a3}可供选择。在
然而,我也没有运气让它发挥作用。使用优秀的^{} library 我试图访问更简单的^{} endpoint (注意,我必须使用
datetime()
对象来建模时间戳):一个
Fault
在这里相当于一个500错误。在当我enable debug logging时,我们可以看到服务器在生成响应时出现问题:
^{pr2}$其中隐藏着错误消息:
或者,在谷歌翻译的帮助下,用英语:
由于我们没有发送任何
common.FormDataListItem
类型、和消息抱怨说,不能生成的XML文档,这在我看来像是服务器端编程错误。在有一些方法可以通过SOAP来工作:
或通过使用
requests
发布application/x-www-form-urlencoded
数据:您可能需要联系这个API的维护人员来解决这个问题,这不是在Python方面可以解决的问题。在
问题是网站处理不当的日期格式。在
错误500包含以下描述:
在他们的页面上从您的浏览器中尝试,以获得更友好的调试: https://www.assurland.com/ws/CarVehiculeSearch.asmx?op=GetCarBodyTypeListByCarAlim
注:“attributxmlcludeouSoapIncludepour spécifier les types qui ne sont pas connus车站”
所以我试着用另一种格式输入日期。在
例如:
^{pr2}$或
19 Jan 2001
您得到
200 OK
请求-在本例中是一个空结果。在不幸的是,过了一年之后,这种格式似乎也不被接受:2001年9月22日的收益率为200英镑,但2015年9月22日的收益率为200英镑 2008年12月31日。在
尝试使用其他日期时间格式。。。但看起来那里有任何东西。。。获取其他站点:)
相关问题 更多 >
编程相关推荐