Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSO_AuthFlow.py Attempt to decode JSON with unexpected mimetype #28

Open
L0L1P0P1 opened this issue Feb 15, 2022 · 5 comments
Open

RSO_AuthFlow.py Attempt to decode JSON with unexpected mimetype #28

L0L1P0P1 opened this issue Feb 15, 2022 · 5 comments

Comments

@L0L1P0P1
Copy link

Hi, first of all, I'm not very experienced.

Thanks for your good project, but there is a problem that I've encountered. As I try to run RSO_AuthFlow.py, data = await r.json() raises an error for Unexpected mimetype text/http. Is there anything that I'm doing wrong? Is it because of my region?(I changed na to eu and replaced USERNAME etc with my own info) I'll be happy if you help <3

@ImLisaa
Copy link

ImLisaa commented Mar 5, 2022

Hey there,

I'm not a Developer nor have I worked on this, but I took my time to debug the connection since I also wanted to use the API. It sems like they updated something since when you send the request, you get no JSON response back.

You get the following content:
<ClientResponse(https://auth.riotgames.com/api/v1/authorization) [403 Forbidden]> <CIMultiDictProxy('Date': 'Sat, 05 Mar 2022 01:45:29 GMT', 'Content-Type': 'text/html; charset=UTF-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'X-Frame-Options': 'SAMEORIGIN', 'Referrer-Policy': 'same-origin', 'Cache-Control': 'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'Expires': 'Thu, 01 Jan 1970 00:00:01 GMT', 'Expect-CT': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'X-RiotGames-CDN': 'Cloudflare', 'Vary': 'Accept-Encoding', 'Server': 'cloudflare', 'CF-RAY': '6e6f2c28be552671-TXL', 'Content-Encoding': 'gzip')>

Seems like they updated something to their system or something, I'll look if I get it somehow but other than waiting nothing we can really do.

@ImLisaa
Copy link

ImLisaa commented Mar 5, 2022

So I found a fix, you actually need to set a header in the ClientSession

session = aiohttp.ClientSession(headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " "AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/99.0.4844.51 Safari/537.36"})

@musnows
Copy link

musnows commented Jul 4, 2022

So I found a fix, you actually need to set a header in the ClientSession

session = aiohttp.ClientSession(headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " "AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/99.0.4844.51 Safari/537.36"})

Hi,I got err while using RSO_AuthFlow.py. It seems no changed after using the session you mention T.T

Fatal error on SSL transport
AttributeError: 'NoneType' object has no attribute 'send'
Exception ignored in: <function _SSLProtocolTransport.__del__ at 0x000002182291F400>
RuntimeError: Event loop is closed

@mhcifci
Copy link

mhcifci commented Sep 4, 2022

When I check I get this error because it redirects to 403 response. This is not json response..
I think the error here occurs because the file is not returned as json. @Aewait

image

@musnows
Copy link

musnows commented Sep 4, 2022

When I check I get this error because it redirects to 403 response. This is not json response.. I think the error here occurs because the file is not returned as json. @Aewait

image

Thanks for the information. Now I use https://github.com/floxay/python-riot-auth to get token,it works well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants