add function to access BNN lists
This commit is contained in:
parent
2a776d5c5f
commit
d4fe69d4fb
|
@ -6,6 +6,7 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
bnn "gitea.statsd.de/dom/goBnn"
|
||||
"golang.org/x/text/encoding/charmap"
|
||||
)
|
||||
|
||||
|
@ -145,3 +146,37 @@ func RetrievePricelist(client *http.Client) ([]SpricelistEntry, error) {
|
|||
return priceList, nil
|
||||
|
||||
}
|
||||
|
||||
// RetrieveBnnlistPL - Downloads list PL and converts bnn list into an array
|
||||
func RetrieveBnnlistPL(client *http.Client) (bnn.Bnn, error) {
|
||||
// Download bnn
|
||||
resp, err := client.Get("https://static.paxan.de/2016/PL.BNN")
|
||||
if err != nil {
|
||||
return bnn.Bnn{}, err
|
||||
}
|
||||
|
||||
b, err := bnn.ReadBnn(resp.Body)
|
||||
if err != nil {
|
||||
return bnn.Bnn{}, err
|
||||
}
|
||||
|
||||
return b, nil
|
||||
|
||||
}
|
||||
|
||||
// RetrieveBnnlistPLF - Downloads list PLF and converts bnn list into an array
|
||||
func RetrieveBnnlistPLF(client *http.Client) (bnn.Bnn, error) {
|
||||
// Download bnn
|
||||
resp, err := client.Get("https://static.paxan.de/2016/PLF.BNN")
|
||||
if err != nil {
|
||||
return bnn.Bnn{}, err
|
||||
}
|
||||
|
||||
b, err := bnn.ReadBnn(resp.Body)
|
||||
if err != nil {
|
||||
return bnn.Bnn{}, err
|
||||
}
|
||||
|
||||
return b, nil
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue