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

Static Data champion, GetByKey returns RiotSharpException: 403, Forbidden #688

Open
SharkiCS opened this issue Jun 20, 2021 · 9 comments
Open

Comments

@SharkiCS
Copy link

SharkiCS commented Jun 20, 2021

I've been checking that it wasn't me, testing with different keys. (The same happened to me with the GetSummonerByAccountIdAsync and GetSummonerBySummonerIdAsync methods, I just ignored it and continue working with the GetSummonerByNameAsync method). These two first methods returned a RiotSharpException: 403, Forbidden

However, I tried .Champions.GetByKeyAsync right now and it also returns the same exception.

This is the exact code.
var test = api.StaticData.Champions.GetByKeyAsync(championId.ToString(), version[0]).Result.Image.Full;

@xXLAOKOONXx
Copy link
Contributor

Regarding GetSummoner:
Please consider that summonerId and accountId are encrypted by the key you are using. If you try the function with a summonerId/accountId encrypted with an older api key (eg Dev Key from yesterday) you might get this response (tbh idk which code you get).

Regarding .Champions.GetByKeyAsync:
Can you tell me what values you are using for the request? (version & key)
There is a similar function called 'GetByIdAsync' if he key you enteris an integer you should use 'GetByIdAsync' instead of ByKey.

@SharkiCS
Copy link
Author

Hello!, there's no GetByIDAsync method.

image

The version value is 11.12.1
The key value is 72 which is supposed to be Nidalee

@xXLAOKOONXx
Copy link
Contributor

There should be

public async Task<ChampionStatic> GetByIdAsync(int id, string version, Language language = Language.en_US)

Do you use the nuget package from online or did you build yourself?
The online one is no longer maintained, so you need to build it yourself either as dll or nuget. (see https://github.com/BenFradet/RiotSharp#build-your-own-latest-nuget-package)

@SharkiCS
Copy link
Author

SharkiCS commented Jun 20, 2021

I see, I'm sorry would you mind to guide me how to do that? Since I'm a little bit lost. I've always installed the nuget packages online. I've download the Riot Sharp project. What'd be the next? Since I can't build up because it's a class. (A video, or any stuff showing the step by step is enough, if you're fine with that) Thanks in advance!

@xXLAOKOONXx
Copy link
Contributor

Maybe this one can help you as well #676

@SharkiCS
Copy link
Author

Thanks a lot, now it works perfectly!

@SharkiCS
Copy link
Author

SharkiCS commented Jun 21, 2021

Sorry to bother again but for some reason the method stays waiting until infinity. It doesn't even return any kind of exception.

var test = api.DataDragon.Champions.GetByIdAsync(72, version[0]).Result.Image.Full;

(The version value is 11.12.1)

It is something that I'm doing wrong?

@xXLAOKOONXx
Copy link
Contributor

Following code works for me without any issue, besides the champ behind 72 being Skarner ;)
https://pastebin.com/VD3ZqHAj

        var ddragon = new RiotSharp.Endpoints.StaticDataEndpoint.StaticEndpointProvider(new RiotSharp.Http.Requester(), new RiotSharp.Caching.PassThroughCache());
        var dragon = new RiotSharp.Endpoints.StaticDataEndpoint.DataDragonEndpoints(ddragon);
        var nidaTask = dragon.Champions.GetByIdAsync(72, "11.12.1");
        var nidaResult = nidaTask.Result;

        Console.WriteLine(nidaResult.Image.Full);
        // Prints "Skarner.png"

        var api = RiotSharp.RiotApi.GetDevelopmentInstance("hbiahbdiahbd");
        var skarnerTask = api.DataDragon.Champions.GetByIdAsync(72, "11.12.1");
        var skarnerResult = skarnerTask.Result;

        Console.WriteLine(skarnerResult.Image.Full);
        // Prints "Skarner.png"

@SharkiCS
Copy link
Author

SharkiCS commented Jun 21, 2021

Weird, it might be something relate to my code. Tried this

        var api = RiotSharp.RiotApi.GetDevelopmentInstance("hbiahbdiahbd");
        var skarnerTask = api.DataDragon.Champions.GetByIdAsync(72, "11.12.1");
        var skarnerResult = skarnerTask.Result;

with my ApiKey of course, and get the same result. However, I got all champions with GetAllAsync method, so I'm working with that.

PS; My mind is a mess and the whole time I was thinking 72 was nida despite I knew it was 76, haha, however, thanks for your help, was really useful!

Have a good day.

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

2 participants