Skip to content

Instantly share code, notes, and snippets.

@burakcanekici
Last active July 20, 2020 13:18
Show Gist options
  • Save burakcanekici/b7ef884e81da9dd8fbb113d8fb87dc13 to your computer and use it in GitHub Desktop.
Save burakcanekici/b7ef884e81da9dd8fbb113d8fb87dc13 to your computer and use it in GitHub Desktop.
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();
}
}
}
@burakcanekici
Copy link
Author

~be

@burakcanekici
Copy link
Author

~be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment