On April 13th, I ran the Monument 10k in Richmond, VA. It’s a great, fun race, that bring about 35-40k people to the famed Monument Avenue. Bands, costumes and a ton of runners. This is my second time running, and as usual, this type of atmosphere is the most positive and supportive place on earth. I’ve been to many races, some I’ve run in, some I’ve cheered friends and family on, but it’s always the most uplifting environment you can be in. If you aren’t a runner, get out there, work on it, get to events like this. Bring your kids, show them the positive sides of exercise.

On April 15th, the unthinkable happened. Some whacko decided to place a few explosives near the finish line of the Boston Marathon. It’s another senseless act of violence, that can never be explained. It hit home, due to the type of environment, and how recently I had been in a very similar situation.

Every day, I live network security, network surveillance and data extraction. I was curious to how I could ‘help’ in a situation like this, as part of the global group of good guy coders. This post isn’t going to be anything new, or novel, but it was a quick way for me to get some photos of the area that the bomb occurred, and out of curiosity, see if there were any clear shots in the time around the event. More may come , depending on how much I can dig into this problem (and potential tool to help solve it), but here’s a quick script to do some flickr API searches around a geo-coordinate, over a time range, sort them in chronological order, and have a little time series on the events of the day.

Pretty straight forward process:
search_pics = {}
searchURL = 'http://api.flickr.com/services/rest/'
search_response = requests.get(searchURL,params=search_pics)
print search_response.status_code
parsed_search_response = search_response.json()

Set up some search parameters. Time bound on ‘taken date’ of each photo. Lat/Long coordinates were pulled from the wikipedia article on the bombings. Safe search is set to 3 (basically, off), radius of one half mile, and I want as many results as I can get. Pagination and going past 300 records isn’t build, since I didn’t get that many results yet. I’m going to continue to run this over time to see if more photos are uploaded, and to fill into my time series.

Then, for each photo, I need the timestamp, and since I like UTC Epochs, I build it from the flickr.photos.getInfo end point:

photos = parsed_search_response['photos']
for photo in photos['photo']:
photo_info_url = 'http://api.flickr.com/services/rest/'
photo_info_parms = {}
photo_info_parms['method'] = 'flickr.photos.getInfo'

photoinfo = requests.get(photo_info_url,params=photo_info_parms)
photod = photoinfo.json()
dttm = photod['photo']['dates']['taken']
mysql_time_struct = time.strptime(dttm, '%Y-%m-%d %H:%M:%S')
ts = calendar.timegm(mysql_time_struct)
print ts

Then, I write the picture data to a file on disk, with a file name in the format of (timestamp_id_secret.jpg)
photo_url = 'http://farm%s.staticflickr.com/%s/%s_%s_b.jpg' % ( photo['farm'], photo['server'], photo['id'],photo['secret'])
r = requests.get(photo_url)
with open("./downloadedfiles/%d_%s_%s.jpg"%(ts, photo['id'],photo['secret']), "wb") as code:

The result is a big list of pictures, and it’s almost like a slideshow of the area. I have ideas on how to make this better, but for now, it’s a start.

slideshow photots of boston marathon

slideshow photots of boston marathon

Short URL: http://bit.ly/291QJDq