RiotSharp
RiotSharp copied to clipboard
Static Data champion, GetByKey returns RiotSharpException: 403, Forbidden
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;
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.
Hello!, there's no GetByIDAsync
method.
The version
value is 11.12.1
The key
value is 72
which is supposed to be Nidalee
There should be https://github.com/BenFradet/RiotSharp/blob/38915505ea7edf00e046acc53f88fc54d486d432/RiotSharp/Endpoints/StaticDataEndpoint/Champion/StaticChampionEndpoint.cs#L71 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)
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!
Maybe this one can help you as well https://github.com/BenFradet/RiotSharp/issues/676
Thanks a lot, now it works perfectly!
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?
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"
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.