Created
May 1, 2018 02:37
-
-
Save IamTails/5df3cb9d8860e85fe9c183a58ce9d47f to your computer and use it in GitHub Desktop.
C# get
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Test | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Making API Call..."); | |
using (var client = new HttpClient(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate })) | |
{ | |
client.BaseAddress = new Uri("https://nekos.life/api/v2/img/"); | |
HttpResponseMessage response = client.GetAsync("neko").Result; | |
response.EnsureSuccessStatusCode(); | |
string result = response.Content.ReadAsStringAsync().Result; | |
Console.WriteLine("Result: " + result); | |
} | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment