billy-yoyo / RainbowSixSiege-Python-API

Asynchronous python api for rainbow six siege (r6sapi)
MIT License
130 stars 31 forks source link

aiohttp content type error #66

Closed BenGorrr closed 3 years ago

BenGorrr commented 3 years ago

I just found this api and I am trying to use it but I am having this error when running the simple example:

Traceback (most recent call last): File "main.py", line 13, in asyncio.get_event_loop().run_until_complete(run()) File "C:\Users\Z\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py", line 584, in run_until_complete return future.result() File "main.py", line 8, in run operator = await player.get_operator("sledge") File "C:\ProjectPy\R6Stats\env\lib\site-packages\r6sapi\players.py", line 429, in get_operator result = yield from self.load_operator(operator, data=data) File "C:\ProjectPy\R6Stats\env\lib\site-packages\r6sapi\players.py", line 379, in load_operator location = yield from self.auth.get_operator_index(operator) File "C:\ProjectPy\R6Stats\env\lib\site-packages\r6sapi\auth.py", line 451, in get_operator_index opdefs = yield from self.get_operator_definitions() File "C:\ProjectPy\R6Stats\env\lib\site-packages\r6sapi\auth.py", line 437, in get_operator_definitions data = yield from resp.json() File "C:\ProjectPy\R6Stats\env\lib\site-packages\aiohttp\client_reqrep.py", line 795, in json headers=self.headers) aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8' Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x0000020950A88C50> Unclosed connector

Jiggy079 commented 3 years ago

I'm also having this issue. Looks like Ubisoft changed things on their end which stops the library working as it is.

TobyLambda commented 3 years ago

Same problem here. Is there a fix already?

RAYs3T commented 3 years ago

Cause of the issue

From what it looks like Ubisoft deprecated the old API in favor of the new one for https://www.ubisoft.com/de-gb/game/rainbow-six/siege/stats

At least the answer from the API is an actual reference to this new site.

How to deal with this?

This means that the API is most likely unusable. For this API it means the endpoints need to be changed and therefore also the response objects, which got changed. See also #64

TLDR: Lot's of work to adjust this to the latest API changes.

billy-yoyo commented 3 years ago

Over the next few weeks I will begin the work to update the library to the new API, will track it under another ticket so will close this one.