Skip to content

Commit

Permalink
More API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
silasary committed Aug 15, 2024
1 parent aacde9a commit a64131f
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions PDBot.Core/API/Scryfall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ private static Card HitAPI(string address)

try
{
using (var wc = new WebClient
using var wc = new WebClient
{
BaseAddress = "https://api.scryfall.com/"
})
{
var blob = wc.DownloadString(address);
var json = Newtonsoft.Json.JsonConvert.DeserializeObject(blob) as JObject;
return ParseJson(json);
}
BaseAddress = "https://api.scryfall.com/",

};
wc.Headers[HttpRequestHeader.UserAgent] = "PDBot";
var blob = wc.DownloadString(address);
var json = Newtonsoft.Json.JsonConvert.DeserializeObject(blob) as JObject;
return ParseJson(json);
}
catch (WebException)
{
Expand Down Expand Up @@ -98,14 +98,13 @@ private static IEnumerable<Card> HitMultiCardAPI(string address)
try
{

using (var wc = new WebClient
using var wc = new WebClient
{
BaseAddress = "https://api.scryfall.com/"
})
{
Console.WriteLine(address);
blob = wc.DownloadString(address);
}
};
wc.Headers[HttpRequestHeader.UserAgent] = "PDBot";
Console.WriteLine(address);
blob = wc.DownloadString(address);
}
catch (WebException)
{
Expand Down

0 comments on commit a64131f

Please sign in to comment.