Skip to content

VimanyuAgg/CMPE273-lab2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

#SpotCrime RPC using Python Spyne:

This repo builds a simple RPC application to check crime report for a location using Spyne toolkit to build the application. Input protocol is HttpRpc and output is JSON as described below.

##Input (HttpRpc)

  • lat - latitude of a location
  • lon - longitude of a location
  • radius - radius distance in miles.
curl "http://localhost:8000/checkcrime?lat=37.334164&lon=-121.884301&radius=0.02"

##Output (Json)

{
    "total_crime" : 24,
    "the_most_dangerous_streets" : [ "E SANTA CLARA ST", "E SAN FERNANDO ST" , "N 11TH ST" ],
    "crime_type_count" : {
        "Assault" : 10,
        "Arrest" : 8,
        "Burglary" : 6,
        "Robbery" : 4,
        "Theft" : 2,
        "Other" : 1
    },
    "event_time_count" : {
        "12:01am-3am" : 5,
        "3:01am-6am" : 0,
        "6:01am-9am" : 1,
        "9:01am-12noon" : 2,
        "12:01pm-3pm" : 2,
        "3:01pm-6pm" : 1,
        "6:01pm-9pm" : 0,
        "9:01pm-12midnight" : 9
    } 
}

Example Crime Report near SJSU

curl -i "https://api.spotcrime.com/crimes.json?lat=37.334164&lon=-121.884301&radius=0.02&key=."

About

RPC using Spyne

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages