Skip to content

Commit

Permalink
Solved error when event has no address
Browse files Browse the repository at this point in the history
  • Loading branch information
lmorillas committed Oct 26, 2015
1 parent 2935b21 commit 440f40c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions extract_calendars.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,15 @@ def event_to_item(event, cal):
item['cal'] = cal
item['month'] = get_month(item.get('start'))
address = event.get('location')
location = geolocate(address)
if location:
lat = location[0]
lon = location[1]
item['latlon'] = "{},{}".format(lat, lon)
print item['latlon']
country = loc_to_country(item['latlon'])
item['country'] = country
if address:
location = geolocate(address)
if location:
lat = location[0]
lon = location[1]
item['latlon'] = "{},{}".format(lat, lon)
print item['latlon']
country = loc_to_country(item['latlon'])
item['country'] = country
return item

def create_index():
Expand Down

0 comments on commit 440f40c

Please sign in to comment.