从RESTAPI提取数据的Python脚本失败,错误为

时间:2018-02-05 07:52:07

标签: python

当我运行我的Python脚本从应用程序的RESTAPI获取数据时,我收到以下错误。我安装了PIP,我安装了python的请求包。这是我的以下查询:

./ simpleRunQuery.py <args> <args>

Traceback (most recent call last):
  File "./simpleRunQuery.py", line 25, in <module>
    res = requests.post(url, auth=(args.username, args.password), data=jsonRequest, headers=headers)

  File "/Library/Python/2.7/site-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Python/2.7/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/Library/Python/2.7/site-packages/requests/adapters.py", line 490, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(54, 'Connection reset by peer'))

我可以附加脚本,但是我的脚本没有行112或58或其中任何一行,它是一个简单的RESTAPI脚本,可以在此查询和发布结果。有什么指针吗?

0 个答案:

没有答案