Skip to content

Instantly share code, notes, and snippets.

@gnrfan
Created September 17, 2013 21:00
Show Gist options
  • Save gnrfan/6600563 to your computer and use it in GitHub Desktop.
Save gnrfan/6600563 to your computer and use it in GitHub Desktop.
Un ejemplo sencillo de como acceder de forma programática, usando Python. a los datos de la Municipalidad de Lima. Más información en http://lima.datosabiertos.pe/
#!/usr/bin/env python
#
# This is a demo script on how to use the Junar API provided by http://lima.datosabiertos.pe/
# More info un Junar APIs here: http://wiki.junar.com/index.php/API
#
# Steps to install the Junar API client in a virtual environment:
#
# virtualenv --no-site-packages env
# source env/bin/activate
# pip install git+git://github.com/Junar/junar-api-python-client.git
#
# You can obtain an API Key without registering from this URL:
# http://lima.datosabiertos.pe/developers/
import json
from junar import ApiClient
MUNILIMA_JUNAR_API_KEY = '<paste your Junar API key here>'
MUNILIMA_DATASET_GUID = 'MUSEO-DE-LIMA'
junar_api_client = ApiClient(MUNILIMA_JUNAR_API_KEY)
datastream = junar_api_client.datastream(MUNILIMA_DATASET_GUID)
print json.dumps(datastream.invoke(output = 'json_array'), indent=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment