A go client library for the data.police.uk API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis.yml
LICENSE
README.md
availability.go cleaned up comments Nov 15, 2018
availability_test.go
crime.go
crime_test.go updated unit tests to work with nested structs Oct 28, 2018
force.go
force_test.go
location.go
neighbourhood.go cleaned up comments Nov 15, 2018
neighbourhood_test.go added more methods and tests to the neighbourhood service Oct 16, 2018
options.go
options_test.go
stopandsearch.go
stopandsearch_test.go
strings.go
strings_test.go
ukpolice.go
ukpolice_test.go

README.md

ukpolice

Documentation Build Status Coverage Status Go Report Card

ukpolice is a Go client library for accessing the data.police.uk api

Usage

import "github.com/tjcain/ukpolice"

Construct a new ukpolice client, then use the various services on the client to access different parts of the data.police.uk API. It is recommended to pass in a http.Client with a longer timeout than default as some responses from the API can take over 60 seconds.

For example:

customClient := http.Client{Timeout: time.Second * 120}
	client := ukpolice.NewClient(&customClient))

// list all available data sets.
available, _, err := client.Availability.GetAvailabilityInfo(context.Background())

Some API methods have optional parameters that can be passed. For example:

searches, _, err := client.StopAndSearch.GetStopAndSearchesByForce(context.Background(),
        ukpolice.WithDate("2018-01"), ukpolice.WithForce("west-midlands"))

Rate Limiting

The data.police.uk api sets a rate limit of 15 requests per second. This limit is adhered to automatically by the package.

Contributing

Contributions are always welcome.