An open API service indexing awesome lists of open source software.

https://github.com/jxsl13/dawum

dawum.de Go client
https://github.com/jxsl13/dawum

elections politics polls surveys

Last synced: 4 months ago
JSON representation

dawum.de Go client

Awesome Lists containing this project

README

          

# dawum - a dawum.de Go client

This is a small utility for fetching German election poll data from the https://dawum.de api.

Reference: https://dawum.de/API/

# import dependency

```shell
go get github.com/jxsl13/dawum@latest
```

# example usage

```go
package main

import (
"fmt"
"github.com/jxsl13/dawum"
)

func main() {
ExampleGetLastUpdate()
ExampleGetData()
}

func ExampleGetData() {
data, err := dawum.GetData(context.Background())
if err != nil {
panic(err)
}

fmt.Println(data)
// {"Database":{"License":{"Name":"ODC Open Database License","Shortcut":"ODC-ODbL","Link":"https........
}

func ExampleGetLastUpdate() {
datetime, err := dawum.GetLastUpdate(context.Background())
if err != nil {
panic(err)
}

fmt.Println(datetime)
// 2023-09-29T09:41:59+02:00
}
```