https://github.com/teamjorge/eskomlol
Eskom Loadshedding API package
https://github.com/teamjorge/eskomlol
Last synced: 5 months ago
JSON representation
Eskom Loadshedding API package
- Host: GitHub
- URL: https://github.com/teamjorge/eskomlol
- Owner: teamjorge
- License: apache-2.0
- Created: 2021-10-27T15:20:01.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-18T20:03:19.000Z (over 4 years ago)
- Last Synced: 2024-08-12T17:25:10.382Z (almost 2 years ago)
- Language: Go
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eskomlol
Eskom Loadshedding API package
`eskomlol` (eskom lekker ol' loadshedding)
## Overview
`eskomlol` provides a thin wrapper around the existing Eskom API for loadshedding. This package attempts to simplify using the not-so-friendly base API. Please note that changes of the API will potentially break this package. If we don't expect Eskom to properly maintain powerstations, we probably can't expect them to maintain an API.
## Usage
```go
package main
import (
"context"
"fmt"
"log"
"time"
"github.com/teamjorge/eskomlol"
)
func main() {
// Creating a new client with no options
client := eskomlol.New()
// Creating a client with some options
client = eskomlol.New(eskomlol.WithTimeout(60 * time.Second))
// Get current loadshedding stage
stage, err := client.Status(context.Background())
if err != nil {
log.Fatal(err)
}
fmt.Println("Stage\n", stage)
// Hopefully prints -1 or 0 :D
}
```
Additional calls you can make are:
* `Municipalities`
* `Suburbs`
* `SearchSuburbs` (Similar to Suburbs but does not require a municipality)
* `Schedule`
## Notes
During testing I've noticed that some of the suburbs do not have schedules available. I'm not 100% sure if this is due to the municipalities not making them available or if it's just Eskom not having them. I'm not sure how ESP are sourcing their info, but I'm assuming it's via scraping. That could potentially be added later if there's demand for it.
## Contributing
If you find bugs or have feature requests, don't be afraid to gooi a PR or create a new issue. I'm happy to improve this if folks are actually using it.