https://github.com/fluffynuts/lights-out
A dotnet wrapper for the Eskom Se Push load-shedding api
https://github.com/fluffynuts/lights-out
Last synced: 10 months ago
JSON representation
A dotnet wrapper for the Eskom Se Push load-shedding api
- Host: GitHub
- URL: https://github.com/fluffynuts/lights-out
- Owner: fluffynuts
- License: bsd-3-clause
- Created: 2023-05-09T11:12:38.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-12T15:05:02.000Z (about 3 years ago)
- Last Synced: 2025-08-01T01:38:08.674Z (11 months ago)
- Language: C#
- Size: 175 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Lights Out
---
dotnet Api & tooling around the Eskom Se Push REST api
You will need to obtain an api key from:
https://eskomsepush.gumroad.com/l/api
A personal token with usage limits can be obtained for free.
Installation
---
Use your favorite nuget package manager to install the package `LightsOut`, eg
`dotnet add package LightsOut`
Usage
---
```csharp
using LightsOut;
public class Program
{
public async Task Main()
{
// create an instance of the api with a token
// -> if the token is ommitted, the library
// will attempt to read it from the environment
// variable ESP_API_TOKEN
var api = new Api("");
var overallStatus = await api.FetchStatus();
Console.WriteLine($"national status: {overallStatus["eskom"].CurrentStage}");
var areas = await api.SearchAreas("johannesburg")
var areaId = areas.First().Id;
var schedule = await api.FetchAreaSchedule(areaId);
var next = schedule.Events.First();
Console.WriteLine(
$"Next demonstration of Eskom ineptitude: {next.Note} at {next.Start} (until {next.End})"
);
}
}
```