weixin_39828331
weixin_39828331
2020-12-28 14:22

urllib.error.HTTPError: HTTP Error 500: Internal Server Error for is_API_online()

Thanks for this great library. However, a couple of things:

For the code


owm = pyowm.OWM('MY_VALID_KEY')
apionline = owm.is_API_online()
print(apionline)

I get


Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/pyowm/commons/owmhttpclient.py", line 72, in call_API
    response = urlopen(url, None, timeout)
  File "/usr/lib/python3.5/urllib/request.py", line 163, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.5/urllib/request.py", line 472, in open
    response = meth(req, response)
  File "/usr/lib/python3.5/urllib/request.py", line 582, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.5/urllib/request.py", line 510, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 590, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "owtest.py", line 42, in <module>
    apionline = owm.is_API_online()
  File "/usr/local/lib/python3.5/dist-packages/pyowm/webapi25/owm25.py", line 165, in is_API_online
    API_AVAILABILITY_TIMEOUT)
  File "/usr/local/lib/python3.5/dist-packages/pyowm/commons/owmhttpclient.py", line 74, in call_API
    raise api_call_error.APICallError(str(e), e)
pyowm.exceptions.api_call_error.APICallError: <exception str failed>
</exception></module>

However, the rest works in that I can retrieve a valid weather forecast, apart from this other issue I just logged https://github.com/csparpa/pyowm/issues/132

Thanks!

该提问来源于开源项目:csparpa/pyowm

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

8条回答

为你推荐