This commit is contained in:
@@ -4,6 +4,7 @@ using SuccessfulCodeTools;
|
|||||||
using SuccessfulCodeTools.LowLevelHttpClient;
|
using SuccessfulCodeTools.LowLevelHttpClient;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -49,7 +50,10 @@ namespace BritishHorseRacingApi
|
|||||||
{
|
{
|
||||||
await Task.Delay(TimeSpan.FromSeconds(_waitTimeAfterFail));
|
await Task.Delay(TimeSpan.FromSeconds(_waitTimeAfterFail));
|
||||||
_client.DefaultHeaders.Items.Clear();
|
_client.DefaultHeaders.Items.Clear();
|
||||||
|
_client.OutgoingPort++;
|
||||||
message = CreateTokenMessage();
|
message = CreateTokenMessage();
|
||||||
|
message.Headers.Items.RemoveAll(e => e.Key == "Accept-Language");
|
||||||
|
message.Headers.Items.Add(new KeyValuePair<string, string>("Accept-Language",$"en-US,en;q=0.9;id={Guid.NewGuid().ToString()}"));
|
||||||
response = await _client.SendAsync(message);
|
response = await _client.SendAsync(message);
|
||||||
content = response.Content;
|
content = response.Content;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace BritishHorseRacingApi
|
|||||||
{
|
{
|
||||||
public abstract class BaseApiClient
|
public abstract class BaseApiClient
|
||||||
{
|
{
|
||||||
private const int _startPort = 55948;
|
private const int _startPort = 50010;
|
||||||
protected readonly CustomHttpClient _client = new CustomHttpClient(_startPort);
|
protected readonly CustomHttpClient _client = new CustomHttpClient(_startPort);
|
||||||
private readonly TimeSpan? _delay;
|
private readonly TimeSpan? _delay;
|
||||||
private DateTime _lastRequest = DateTime.UtcNow;
|
private DateTime _lastRequest = DateTime.UtcNow;
|
||||||
|
|||||||
Reference in New Issue
Block a user