Forces¶
-
class
police_api.forces.Force(api, preload=False, **attrs)[source]¶ A police force.
>>> from police_api import PoliceAPI >>> from police_api.forces import Force >>> api = PoliceAPI() >>> force = Force(api, id='leicestershire') >>> print(force.name) Leicestershire Police
Parameters: - api (PoliceAPI) – The API instance to use.
- preload (bool) – If
True, attributes are loaded from the API on instantiation rather than waiting for a property to be accessed. - attrs – Only the
idis required. Any other attributes supplied will be set on the instance and not fetched from the API.
-
id¶ Type: str The force’s identifier (a slugified version of the name).
-
name¶ Type: str The full name of the force.
-
description¶ Type: str A short description of the force’s role.
-
url¶ Type: str The force’s website address.
-
telephone¶ Type: str The force’s main switchboard number. Usually set to
'101'since the introduction of the national service.
-
engagement_methods¶ Type: list A
listofdict, containing the keysurl,type,description, andtitle.>>> from pprint import pprint >>> pprint(['{type}: {url}'.format(**method) ... for method in force.engagement_methods]) ['facebook: http://www.facebook.com/leicspolice', 'twitter: http://www.twitter.com/leicspolice', 'youtube: http://www.youtube.com/leicspolice', 'rss: http://www.leics.police.uk/feeds/news/', 'telephone: ', 'flickr: http://www.flickr.com/photos/leicspolice-property']
-
neighbourhoods¶ Type: list A
listofNeighbourhoodobjects (all the Neighbourhood Policing Teams in this force area).
-
senior_officers¶ Type: list A
listofForce.SeniorOfficerobjects.
-
class
SeniorOfficer(api, data={})[source]¶ A senior police officer. Uses the senior-officers API call.
Parameters: - api (PoliceAPI) – The API instance to use.
- data (dict) – The attributes that will be copied to this instance.
-
name¶ Type: str The officer’s name.
-
rank¶ Type: str The officer’s rank.
-
bio¶ Type: str The officer’s biography.
-
contact_details¶ Type: list A
listofdict, containing methods of contacting the officer.>>> from police_api import PoliceAPI >>> force = PoliceAPI().get_force('leicestershire') >>> officer = force.senior_officers[0] >>> print(officer.contact_details['twitter']) http://www.twitter.com/CCLeicsPolice