Successful CartoDB Python API call doesn't update map?

393 views Asked by At

Using urllib to make my API call to CartdoDB (per Andrew Hill's example here). I'm getting a successful '200' in response, and can get the script to print out my JSON response, but my problem is the map doesn't update after making this SELECT statement. Am I missing a step in order for that to happen?

Thanks!

Ben


import urllib
import urllib2
import json

username = '[MY USER NAME]'
apikey = '[MY API KEY]'
query = 'SELECT * FROM map_census_acs2012_ct WHERE (population > 8000 AND population <= 26908)'

url = "https://[MY USER NAME].cartodb.com/api/v1/sql"

# prams object that holds our api key and query.
params = {
    'api_key' : apikey,
    'q'       : query  
}

req = urllib2.Request(url, urllib.urlencode(params))
res = urllib2.urlopen(req)
res.getcode()
1

There are 1 answers

0
matallo On BEST ANSWER

as John Barça says, in order to properly update your map in the client-side with the new data you'll need to use the CartoDB.js API.

ps: I'm adding the comment as an answer in order to be able to mark it as valid.