Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting JSON response from Mapqeustapi
    primarykey
    data
    text
    <p>I'm trying to get a response from MapquestAPI in a JSON format. using the same URL, I can get results when calling from bash</p> <pre><code>wget -q -O - "http://www.mapquestapi.com/geocoding/v1/batch?key=F20%2C7a%3Do5-hrtl1&amp;callback=renderBatch&amp;json=%7B%27locations%27%3A+%5B%7B%27street%27%3A+%2711880+San+Pablo+Ave%2C+El+Cerrito%27%7D%2C+%7B%27street%27%3A+%271780+E+Buena+Vista+Dr%2C+Orlando%27%7D%2C+%7B%27street%27%3A+%2714+Greenway+Circle%2C+Sacramento%27%7D%2C+%7B%27street%27%3A+%27160+Kingsland+St%2C+Nutley%27%7D%2C+%7B%27street%27%3A+%27816+Western+Ave%2C+Glen+Ellyn%27%7D%5D%7D,options:{thumbMaps:false}}" </code></pre> <p>When doing it python way:</p> <pre><code>import urllib2, urllib import json url = "http://www.mapquestapi.com/geocoding/v1/batch?key=Fmjtd%7Cluua2dua20%2C7a%3Do5-hrtl1&amp;callback=renderBatch&amp;json=%7B%27locations%27%3A+%5B%7B%27street%27%3A+%2711880+San+Pablo+Ave%2C+El+Cerrito%27%7D%2C+%7B%27street%27%3A+%271780+E+Buena+Vista+Dr%2C+Orlando%27%7D%2C+%7B%27street%27%3A+%2714+Greenway+Circle%2C+Sacramento%27%7D%2C+%7B%27street%27%3A+%27160+Kingsland+St%2C+Nutley%27%7D%2C+%7B%27street%27%3A+%27816+Western+Ave%2C+Glen+Ellyn%27%7D%5D%7D,options:{thumbMaps:false}}" print url data = json.dumps([1,2,3]) req = urllib2.Request(url, data, {'Content-Type': 'application/json'}) f = urllib2.urlopen(req) response = f.read print f.read </code></pre> <p>this is the result</p> <pre><code> &lt;bound method _fileobject.read of &lt;socket._fileobject object at 0x1a41bd0&gt;&gt; </code></pre> <p>any suggestions how can I get the JSON output in PY?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload