SSL error: application data after close_notify
lapster88 opened this issue · 0 comments
lapster88 commented
Summary
When using ayncio.gather on GetFullMatch, I get an SSL error. I think this is a python core issue (https://bugs.python.org/issue39951) but I'm hoping someone here might be able to recommend a work around.
Reproduction Steps
This snippet should be able to reproduce the error:
import callofduty as cod
import asyncio
async def main():
id = 'BattleNetID of interest'
client = await cod.Login("UserName", "Password")
player = await client.GetPlayer(cod.Platform.BattleNet, id)
matches = await player.matches(cod.Title.ModernWarfare, cod.Mode.Warzone)
match_details = await asyncio.gather(*(client.GetFullMatch(cod.Platform.BattleNet, cod.Title.ModernWarfare, cod.Mode.Warzone, match.id) for match in matches))
asyncio.run(main())
I tried it using Activision instead of BattleNet as the platform and still got the error.
Expected Results
I expected the asyncio.gather call to return a list of match-details dictionaries.
Actual Results
Traceback (most recent call last):
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpx/_exceptions.py", line 326, in map_exceptions
yield
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpx/_client.py", line 1502, in _send_single_request
(status_code, headers, stream, ext,) = await transport.arequest(
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 218, in arequest
response = await connection.arequest(
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpcore/_async/connection.py", line 106, in arequest
return await self.connection.arequest(method, url, headers, stream, ext)
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpcore/_async/http11.py", line 72, in arequest
) = await self._receive_response(timeout)
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpcore/_async/http11.py", line 133, in _receive_response
event = await self._receive_event(timeout)
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpcore/_async/http11.py", line 172, in _receive_event
data = await self.socket.read(self.READ_NUM_BYTES, timeout)
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpcore/_backends/asyncio.py", line 153, in read
raise
File "/home/matt/miniconda3/envs/cod/lib/python3.9/contextlib.py", line 135, in __exit__
self.gen.throw(type, value, traceback)
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
raise to_exc(exc) from None
httpcore.ReadError: [SSL: APPLICATION_DATA_AFTER_CLOSE_NOTIFY] application data after close notify (_ssl.c:2744)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/mnt/c/Users/mlapp/CodStats/bug.py", line 51, in <module>
asyncio.run(main())
File "/home/matt/miniconda3/envs/cod/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/home/matt/miniconda3/envs/cod/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/mnt/c/Users/mlapp/CodStats/bug.py", line 14, in main
match_details = await asyncio.gather(*(client.GetFullMatch(cod.Platform.BattleNet, cod.Title.ModernWarfare, cod.Mode.Warzone, match.id) for match in matches))
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/callofduty/client.py", line 662, in GetFullMatch
await self.http.GetFullMatch(
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/callofduty/http.py", line 273, in GetFullMatch
return await self.Send(
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/callofduty/http.py", line 103, in Send
res: Response = await client.request(
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpx/_client.py", line 1371, in request
response = await self.send(
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpx/_client.py", line 1406, in send
response = await self._send_handling_auth(
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpx/_client.py", line 1444, in _send_handling_auth
response = await self._send_handling_redirects(
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpx/_client.py", line 1476, in _send_handling_redirects
response = await self._send_single_request(request, timeout)
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpx/_client.py", line 1502, in _send_single_request
(status_code, headers, stream, ext,) = await transport.arequest(
File "/home/matt/miniconda3/envs/cod/lib/python3.9/contextlib.py", line 135, in __exit__
self.gen.throw(type, value, traceback)
File "/home/matt/miniconda3/envs/cod/lib/python3.9/site-packages/httpx/_exceptions.py", line 343, in map_exceptions
raise mapped_exc(message, **kwargs) from exc # type: ignore
httpx.ReadError: [SSL: APPLICATION_DATA_AFTER_CLOSE_NOTIFY] application data after close notify (_ssl.c:2744)
Process finished with exit code 1
Checklist
- [x ] I have searched the open Issues for duplicates
- [x ] I have shown the entire traceback, if possible
- [x ] I have removed my token from display, if visible
System Information
This command python -m callofduty -v
didn't work for me but I am using python 3.9, callofduty.py v1.2.2 on WSL Ubuntu with up to date packages.