ntg confirmed ok, back to mock
parent
1320bd1884
commit
afa1bdf56f
|
|
@ -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")
|
||||
|
|
|
|||
10
config.json
10
config.json
|
|
@ -1,5 +1,11 @@
|
|||
{
|
||||
"Interval": "1s",
|
||||
"States": ["NC"],
|
||||
"Once": true
|
||||
"States": ["OH", "CA"],
|
||||
"Once": true,
|
||||
"Brokers": {
|
||||
"NTG": {
|
||||
"Mock": true,
|
||||
"Cookie": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ type Config struct {
|
|||
Once bool
|
||||
Brokers struct {
|
||||
NTG struct {
|
||||
Mock bool
|
||||
Cookie string
|
||||
}
|
||||
}
|
||||
|
|
|
|||
6
main.go
6
main.go
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue