I have created a script that checks on my status every 60 seconds. However after a random period of time I get a connection reset that breaks the code. I am not sure if the issue is with the underlying http.client library, or that Webex is responding with empty data. Any insight or assistance gratefully received. The test code is below:-
import time
from webexteamssdk import WebexTeamsAPI
token = '<my webex token>'
id = '<my webex id>'
api=WebexTeamsAPI(access_token=token)
while True:
status = api.people.get(personId=myid).status
print(status)
time.sleep(60)
The output is as expected for a random period, then I receive a traceback...
active
active
active
active
Traceback (most recent call last):
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
chunked=chunked,
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 426, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
httplib_response = conn.getresponse()
File "/Users/sihart/.pyenv/versions/3.7.6/lib/python3.7/http/client.py", line 1344, in getresponse
response.begin()
File "/Users/sihart/.pyenv/versions/3.7.6/lib/python3.7/http/client.py", line 306, in begin
version, status, reason = self._read_status()
File "/Users/sihart/.pyenv/versions/3.7.6/lib/python3.7/http/client.py", line 275, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 727, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/urllib3/util/retry.py", line 403, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/urllib3/packages/six.py", line 734, in reraise
raise value.with_traceback(tb)
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
chunked=chunked,
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 426, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
httplib_response = conn.getresponse()
File "/Users/sihart/.pyenv/versions/3.7.6/lib/python3.7/http/client.py", line 1344, in getresponse
response.begin()
File "/Users/sihart/.pyenv/versions/3.7.6/lib/python3.7/http/client.py", line 306, in begin
version, status, reason = self._read_status()
File "/Users/sihart/.pyenv/versions/3.7.6/lib/python3.7/http/client.py", line 275, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/webexteamssdk/api/people.py", line 218, in get
json_data = self._session.get(API_ENDPOINT + '/' + personId)
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/webexteamssdk/restsession.py", line 380, in get
response = self.request("GET", url, erc, params=params, **kwargs)
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/webexteamssdk/restsession.py", line 341, in request
response = self._req_session.request(method, abs_url, **kwargs)
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/Users/sihart/mycode/Webex-Teams-Status-Box/venv/lib/python3.7/site-packages/requests/adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
I have created a script that checks on my status every 60 seconds. However after a random period of time I get a connection reset that breaks the code. I am not sure if the issue is with the underlying http.client library, or that Webex is responding with empty data. Any insight or assistance gratefully received. The test code is below:-
The output is as expected for a random period, then I receive a traceback...