首页 > 解决方案 > 使用 Python 从 Web 服务中提取数据

问题描述

我请求访问 Web 服务以使用 Python 从在线数据库中检索数据。数据是数字数组。

他们给了我这两件事:

<DailyReport xmlns="http://...">
<DataFilter>
<Header>
<LineCode>{{LINE_CODE}}</LineCode>
<StartDate>2019-08-20 00:00:00</StartDate>
<EndDate>2019-08-30 00:00:00</EndDate>
<WoType>Standard</WoType>
</Header>
<ViewsType>
<View>WorkAction</View>
<View>Event</View>
<View>Movement</View>
<View>Stop</View>
<View>Stock</View>
<View>Shift Log</View>
<View>WorkingHours</View>
<View>numberOfCoffee</View>
</ViewsType>
</DataFilter>
</DailyReport>

Services/Rapport/DMRSVC.svc/DMRRESTService/GetDMRView

我的问题是没有人能告诉我它是什么或如何使用它。请注意,我在 和 之间隐藏了 url 和变量名

例如通过这样做:

import requests
url = "http://..."
reponse = requests.get(url)
print(reponse)

错误 :

ConnectionError: HTTPConnectionPool(host='...', port=80): Max retries exceeded with url: ... (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001FED1801E08>: Failed to establish a new connection: [WinError 10060] Une tentative de connexion a échoué car le parti connecté n’a pas répondu convenablement au-delà d’une certaine durée ou une connexion établie a échoué car l’hôte de connexion n’a pas répondu'))

我还尝试在 request.get 方法中操作“标题”,但没有结果。我真的不知道该怎么办。

标签: pythonrestweb-services

解决方案


推荐阅读