ntg confirmed ok, back to mock

master
Bel LaPointe 2022-01-09 22:50:34 -05:00
parent 1320bd1884
commit afa1bdf56f
4 changed files with 16 additions and 5 deletions

View File

@ -114,7 +114,7 @@ func (ntg NTGVision) newRequest(states []config.State) (*http.Request, error) {
"MaxNumberOfStopsLimit": nil,
"MaxWeightLimit": nil,
"MinMilesLimit": nil,
"SavedSearchId": nil, ///2956,
"SavedSearchId": 2956,
})
if err != nil {
return nil, err
@ -128,7 +128,7 @@ func (ntg NTGVision) newRequest(states []config.State) (*http.Request, error) {
request.Header.Set("Accept-Language", "en-US,en;q=0.5")
request.Header.Set("Accept-Encoding", "gzip, deflate, br")
request.Header.Set("Content-Type", "application/json;charset=utf-8")
request.Header.Set("Authorization", strings.Split(strings.Split(config.Get().Brokers.NTG.Cookie, "; NTGAuthToken=")[1], "; ")[0])
request.Header.Set("Authorization", "Bearer "+strings.Split(strings.Split(config.Get().Brokers.NTG.Cookie, "; NTGAuthToken=")[1], "; ")[0])
request.Header.Set("Origin", "https://ntgvision.com")
request.Header.Set("DNT", "1")
request.Header.Set("Connection", "keep-alive")

View File

@ -1,5 +1,11 @@
{
"Interval": "1s",
"States": ["NC"],
"Once": true
"States": ["OH", "CA"],
"Once": true,
"Brokers": {
"NTG": {
"Mock": true,
"Cookie": ""
}
}
}

View File

@ -15,6 +15,7 @@ type Config struct {
Once bool
Brokers struct {
NTG struct {
Mock bool
Cookie string
}
}

View File

@ -56,7 +56,11 @@ func once() error {
func getJobs() ([]broker.Job, error) {
states := config.Get().States
brokers := []broker.Broker{broker.NewNTGVision().WithMock()}
ntg := broker.NewNTGVision()
if config.Get().Brokers.NTG.Mock {
ntg = ntg.WithMock()
}
brokers := []broker.Broker{ntg}
jobs := []broker.Job{}
for _, broker := range brokers {
somejobs, err := broker.Search(states)