Last active
July 20, 2020 13:18
-
-
Save burakcanekici/b7ef884e81da9dd8fbb113d8fb87dc13 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public class ReadFromURLProvider | |
{ | |
private const string fileURL = | |
"https://gist.githubusercontent.com/armgilles/194bcff35001e7eb53a2a8b441e8b2c6/raw/92200bc0a673d5ce2110aaad4544ed6c4010f687/pokemon.csv"; | |
private readonly HttpClient _httpClient; | |
public GetURLAndUpdateProvider() | |
{ | |
_httpClient = new HttpClient(); | |
} | |
public async Task ExecuteBackgroundTaskAsync(CancellationToken cancellationToken) | |
{ | |
var response = await _httpClient.GetAsync(fileURL, cancellationToken); | |
if (response.IsSuccessStatusCode) | |
{ | |
var content = await response.Content.ReadAsStringAsync(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
~be