Facebook
From Wet Human, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 133
  1. using System;
  2. using System.Linq;
  3. using System.Net.Http;
  4.  
  5. public class Kata
  6. {
  7.      static readonly string  CRYPTOCURRENCY_API_URL = "https://api.coinlore.net/api/tickers/";
  8.     static void Main(string[] args)
  9.     {
  10.         getCryptoCurrencysAsync();
  11.     }
  12.  
  13.     static async System.Threading.Tasks.Task getCryptoCurrencysAsync()
  14.     {
  15.         Console.WriteLine("get!");
  16.         var httpClient = new HttpClient();
  17.         try
  18.         {
  19.             HttpResponseMessage response = await httpClient.GetAsync("https://api.coinlore.net/api/tickers/");
  20.             response.EnsureSuccessStatusCode();
  21.             string responseBody = await response.Content.ReadAsStringAsync();
  22.             Console.WriteLine(responseBody);
  23.  
  24.         }
  25.         catch (Exception exception) {
  26.             Console.WriteLine("Exception Hit------------");
  27.             Console.WriteLine(exception);
  28.         }
  29.     }
  30.  
  31.    
  32.  
  33.  
  34.  
  35. }