Update status
SuccessfulCode/BritishHorseRacingApi/master This commit looks good

This commit is contained in:
2020-02-27 19:11:40 +00:00
parent 5ba5d926ba
commit f1bbe045fb
2 changed files with 11 additions and 3 deletions
+10 -2
View File
@@ -248,10 +248,17 @@ namespace BritishHorseRacingApi
}
var content = response.Content;
while (content.StartsWith("<"))
while (content.StartsWith("<") || content.StartsWith("Error: \"Failed to connect"))
{
if (!content.StartsWith("<"))
{
await Task.Delay(TimeSpan.FromSeconds(30));
response = await SendRequest(endpoint);
content = response.Content;
continue;
}
await Task.Delay(TimeSpan.FromSeconds(_waitTimeAfterFail));
//_client.OutgoingPort++;
await GetNewToken();
_client.DefaultHeaders.Items.RemoveAll(e => e.Key == "Accept-Language");
_client.DefaultHeaders.Items.Add(new KeyValuePair<string, string>("Accept-Language", $"en-US,en;q=0.9;id={Guid.NewGuid().ToString()}"));
@@ -260,6 +267,7 @@ namespace BritishHorseRacingApi
content = response.Content;
}
if (!response.IsSuccessStatusCode)
{
throw new Exception($"Unexpected error: {content}" );
+1 -1
View File
@@ -1,4 +1,4 @@
namespace BritishHorseRacingApi.Models
{
public enum Status { Runner, Dnf, Withdrawn };
public enum Status { Runner, Dnf, Withdrawn, NonRunner };
}