Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

About

A go client library for the data.police.uk API

Resources

License

Packages

No packages published

Languages