Reference
GeoReport
- class georeport.GeoReport(root_address, jurisdiction=None, api_key=None, output_format='json')
Client that holds the necessary data to make API calls to a given municipality’s Open311 endpoint.
- Parameters:
root_address (str) – Base address of the API endpoint.
jurisdiction (Optional[str], optional) – The jurisdiction (if applicable). Defaults to None.
api_key (Optional[str], optional) – API key for endpoint. Only required if creating service requests. Defaults to None.
output_format (str, optional) – Raw output format from API. Must be either ‘xml’ or ‘json’. Only applicable if the endpoint does not support json. Defaults to ‘json’.
- root_address
Base address of the API endpoint.
- Type:
str
- jurisdiction
The jurisdiction (if applicable). Defaults to None.
- Type:
Optional[str], optional
- api_key
API key for endpoint. Only required if creating service requests. Defaults to None.
- Type:
Optional[str], optional
- output_format
Raw output format from API. Must be either ‘xml’ or ‘json’. Only applicable if the endpoint does not support json. Defaults to ‘json’.
- Type:
str, optional
- Raises:
ValueError – If output_format is not ‘xml’ or ‘json’.
- classmethod from_city(city, api_key=None, output_format='json')
Get the GeoReport object for a known city’s endpoint.
- Parameters:
city (str) – Name of the city.
pi_key (Optional[str], optional) – API key for endpoint. Only required if creating service requests. Defaults to None.
output_format (str, optional) – Raw output format from API. Must be either ‘xml’ or ‘json’. Only applicable if the endpoint does not support json. Defaults to ‘json’.
- Returns:
GeoReport object for that city’s Open311 endpoint
- Return type:
- Raises:
ValueError – If output_format is not ‘xml’ or ‘json’.
- get_service_definition(service_code)
Provide attributes associated with a service code. These attributes can be unique to the city/jurisdiction. This call is only necessary if the Service selected has metadata set as true from the GET Services response.
- Parameters:
service_code (str) – The service code.
- Returns:
The data related to the given service.
- Return type:
Dict
- get_service_list()
Provide a list of acceptable 311 service request types and their associated service codes. These request types can be unique to the city/jurisdiction.
- Returns:
The services.
- Return type:
List[Dict]
- get_service_request(service_request_id)
Query the current status of an individual request.
- Parameters:
service_request_id (str) – The service request ID.
- Returns:
The information contained within the given service request.
- Return type:
Dict
- get_service_requests(service_request_id=None, service_code=None, start_date=None, end_date=None, status=None)
Queries the current status of multiple requests.
- Parameters:
service_request_id (Optional[str], optional) – To call multiple service requests at once, multiple service_request_id can be declared; comma delimited. This overrides all other arguments. Defaults to None.
service_code (Optional[str], optional) – Specify the service type by calling the unique ID of the service_code. This defaults to all service codes when not declared; can be declared multiple times, comma delimited. Defaults to None.
start_date (Optional[str], optional) – Earliest datetime to include in search. When provided with end_date, allows one to search for requests which have a requested_datetime that matches a given range, but may not span more than 90 days. When not specified, the range defaults to most recent 90 days. Must use w3 format, eg 2010-01-01T00:00:00Z. Defaults to None.
end_date (Optional[str], optional) – Latest datetime to include in search. When provided with start_date, allows one to search for requests which have a requested_datetime that matches a given range, but may not span more than 90 days. When not specified, the range defaults to most recent 90 days. Must use w3 format, eg 2010-01-01T00:00:00Z. Defaults to None.
status (Optional[str], optional) – Allows one to search for requests which have a specific status. This defaults to all statuses; can be declared multiple times, comma delimited. Options: open, closed. Defaults to None.
- Returns:
The information contained within the service requests.
- Return type:
List[Dict]
CityEndpoint
CityEndpoints
- class georeport.CityEndpoints
Stores the data for known city endpoints.
- classmethod get(city)
Get the CityEndpoint object for a given city key.
- Parameters:
city (str) – The city’s key.
- Returns:
The CityEndpoint object for the given city key.
- Return type:
- classmethod list_cities()
Get the cities with known endpoints.
- Returns:
The list of cities with known endpoints.
- Return type:
List[str]