Chaged colors
Added handelrs for networking exceptions Made Book selector a bit bigger Fixed issue with publishing date
This commit is contained in:
@@ -5,17 +5,25 @@ namespace Bokhantarare;
|
||||
|
||||
public class Helper
|
||||
{
|
||||
public static string Request(string requestUrl)
|
||||
public static string? Request(string requestUrl)
|
||||
{
|
||||
HttpClient client = new HttpClient();
|
||||
HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, requestUrl);
|
||||
requestMessage.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json"));
|
||||
try
|
||||
{
|
||||
HttpClient client = new HttpClient();
|
||||
HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, requestUrl);
|
||||
requestMessage.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json"));
|
||||
|
||||
//Connect to the URL
|
||||
HttpResponseMessage response = client.SendAsync(requestMessage).Result;
|
||||
//Connect to the URL
|
||||
HttpResponseMessage response = client.SendAsync(requestMessage).Result;
|
||||
|
||||
// Get the response
|
||||
string Output = response.Content.ReadAsStringAsync().Result;
|
||||
return Output;
|
||||
// Get the response
|
||||
string Output = response.Content.ReadAsStringAsync().Result;
|
||||
return Output;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine(ex.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user