from junar import ApiClient if __name__ == '__main__': # display dates related to proposed law at Chilean senado guid = 'CONGR-DE-LA-PROYE-PUBLI' # get an auth_key at www.junar.com/developers/ auth_key = 'yourauthkeyhere' junar_api_client = ApiClient(auth_key) # the guid (identificator) datastream = junar_api_client.datastream(guid) # the parameters are the date in chilean format response = datastream.invoke(params = ['01/01/2011', '01/12/2011'], output = 'json_array') result = response['result'] # iterating the response and printing it for row in result: print '%s -> %s' % (row[4], row[1])
from junar import ApiClient junar_api_client = ApiClient('yourauthkey') datastream = junar_api_client.datastream('CURRE-AGAIN-USD-FULL-LIST') response = datastream.invoke(output='prettyjson') for row in response['result']: print row response = datastream.invoke(output='xml') print response
from junar import ApiClient if __name__ == '__main__': # display dates related to proposed law at Chilean senado guid = 'CONGR-DE-LA-PROYE-PUBLI' # get an auth_key at www.junar.com/developers/ auth_key = 'yourauthkeyhere' junar_api_client = ApiClient(auth_key) # the guid (identificator) datastream = junar_api_client.datastream(guid) # the parameters are the date in chilean format response = datastream.invoke(params=['01/01/2011', '01/12/2011'], output='json_array') result = response['result'] # iterating the response and printing it for row in result: print '%s -> %s' % (row[4], row[1])
#!/usr/bin/env python # -*- coding: utf-8 -*- from junar import ApiClient from functions import production, product_source, region_products, \ product_region_percentages from parameters import GUID, AUTH_KEY, fields junar_api_client = ApiClient(AUTH_KEY) datastream = junar_api_client.datastream(GUID) data = datastream.invoke(output = 'json_array') #print production(data['result'][1:], '2008', 'MAR', 'ANCASH', '0201') #print product_source(data['result'][1:], '0201') #print region_products(data['result'][1:], 'AREQUIPA') print product_region_percentages(data['result'][1:], '2012', '3802')
from junar import ApiClient auth_key = 'yourauthkey'; junar_api_client = ApiClient(auth_key) datastream = junar_api_client.datastream('FARM-CROP-PRICE-BY-PARRI') response = datastream.invoke(params = ['CLARENDON'], output = 'json_array', page = 0, limit = 10) result = response['result'] for row in result: print row
from junar import ApiClient junar_api_client = ApiClient('yourauthkey') datastream = junar_api_client.datastream('CURRE-AGAIN-USD-FULL-LIST') response = datastream.invoke(output = 'prettyjson') for row in response['result']: print row response = datastream.invoke(output = 'xml') print response
import time from junar import ApiClient if __name__ == '__main__': # mixing data about chilean nacional security # get an auth_key at www.junar.com/developers/ auth_key = 'yourauthkey' junar_api_client = ApiClient(auth_key) # the guid (identificator) datastream = junar_api_client.datastream('SEGUR-EN-TASA-DE-DENUN') response = datastream.invoke(output = 'json_array') # creating new data =) my_new_data = [] my_new_data.append(response['result'][3]) my_new_data.append(response['result'][4]) # because your key could has a request limit :-) time.sleep(5) datastream = junar_api_client.datastream('SEGUR-EN-TASA-DE-DETEN') response = datastream.invoke(output = 'json_array') my_new_data.append(response['result'][4]) # "printing" our csv for row in my_new_data: print ','.join( ['"%s"' % cell for cell in row] )