︠0ec0c052-52c9-4b03-9102-87fcb0566ec5s︠ already = '' while True: import os import time import requests spd_roster = requests.get('https://communities.socrata.com/resource/c6fs-9giq.json?department=Police Department&$limit=20000').json() data = os.popen("curl 'http://blue.kingcounty.gov/Courts/Detention/JILS/Default.aspx/GetBookedInLast24Hours' -H 'Cookie: __utma=118493014.656529117.1448050044.1455518831.1458849260.3; __utmz=118493014.1455385038.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); _ceg.s=o4tlw0; _ceg.u=o4tlw0; ASP.NET_SessionId=meymw2fuyd23ru1zmff0mdqn; _gat=1; _ga=GA1.2.656529117.1448050044' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,es;q=0.6' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36' -H 'Content-Type: application/json' -H 'Accept: */*' -H 'Referer: http://blue.kingcounty.gov/Courts/Detention/JILS/default.aspx' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --compressed").read() import json data = json.loads(data)['d'] data = json.loads(data) data = data['People'] for person in data: if str(person) in already: continue already += str(person) name = person['LastName']+', '+person['FirstName'] if name.lower() in str(spd_roster).lower(): print person, name, 'yes' for row in spd_roster: if name.lower() == row['employee'].lower(): print row job_title = row['job_title'] print 'curl -X POST http://textbelt.com/text -d number=2067330105 -d "message=%s %s"' % (name, job_title) print os.system('curl -X POST http://textbelt.com/text -d number=2067330105 -d "message=%s %s"' % (name, job_title)) print os.system('curl -X POST http://textbelt.com/text -d number=6144406403 -d "message=%s %s"' % (name, job_title)) time.sleep(5*60) ︡9aaf6874-90f7-463b-bca8-01dfa784332a︡︡{"stdout":"{u'RealLastName': u'MARTIN', u'FirstName': u'MICHAEL', u'LastName': u'MARTIN', u'DateOfBirth': u'08/17/1965 12:00 AM', u'CCN': u'1791980', u'SearchFoundAlias': False, u'CurrentCustodyFacility': u'Seattle Correctional Facility', u'LatestBooking': {u'CustodyStatus': None, u'BA': u'216010787', u'Facility': None, u'Charges': [], u'BookingDateParseError': None, u'ChargesString': u'MULTIPLE', u'ReleaseDateParseError': None, u'ReleaseDate': None, u'CCN': None, u'BailAmount': None, u'BookingDate': u'04/15/2016 03:22 PM'}, u'DateOfBirthParseError': None, u'RealMiddleName': u'JOSEPH', u'RealDateOfBirth': u'08/17/1965 12:00 AM', u'RealJuniorSenior': u'', u'MiddleName': u'JOSEPH', u'Gender': u'M', u'RealDateOfBirthParseError': None, u'JuniorSenior': u'', u'Race': u'Black', u'InCustody': False, u'VinesToolTip': u'This link will take you to the external VINE application, and will allow you to be notified if this inmate is released from King County detention. ', u'VisitingSchedule': None, u'RealFirstName': u'MICHAEL', u'Bookings': [], u'BailOnCurrentBooking': None}"}︡{"stdout":" MARTIN, MICHAEL yes\n{u'department': u'Police Department', u'employee': u'MARTIN, MICHAEL', u'employee_manager_name': u'FOX, LAURA', u'job_title': u'PARKING ENFOR OFFICER'}\ncurl -X POST http://textbelt.com/text -d number=2067330105 -d \"message=MARTIN, MICHAEL PARKING ENFOR OFFICER\"\n0"}︡{"stdout":"\n0"} ︠2af43564-f1a5-49c3-9373-cb9f5af33335s︠ len(data) ︡f953975f-b99f-44d2-ac15-be4e681aa838︡︡{"stdout":"97\n"}︡{"done":true} ︠5697ef9c-ffc9-407d-a9b9-4d13fa83f6a7︠