Message Boards Message Boards

Avoid "data not available" in a Wolfram|Alpha API?

GROUPS:

Despite the wolframalpha.com giving correct results, any API query of the same exact text

import wolframalpha
client = wolframalpha.Client(abc-123')
res = client.query("cost of living index Austin, TX")
res_string = next(res.results).text
print(res_string)

which prints the (data not available) even though on wolframalpha.com it works fine. Why's that? How fix?

POSTED BY: John A
Answer
4 months ago

You see? Yet if you type into wolframalpha.com it works fine.

<queryresult success="true" error="false" numpods="2" datatypes="Relocation" timedout="" timedoutpods="" timing="1.104" parsetiming="0.458" parsetimedout="false" recalculate="" id="MSPa13651gc102ic7534hghc00004iha7h72fe56bfc9" host="http://www4c.wolframalpha.com" server="58" related="http://www4c.wolframalpha.com/api/v2/relatedQueries.jsp?id=MSPa13661gc102ic7534hghc000069ci6aebb7ha70d34818692085674327666" version="2.6" nodata="true"><pod title="Input interpretation" scanner="Identity" id="Input" position="100" error="false" numsubpods="1"><subpod title=""><img src="http://www4c.wolframalpha.com/Calculate/MSP/MSP13671gc102ic7534hghc00001ege39i2f311b690?MSPStoreType=image/gif&s=58" alt="Austin, Texas | cost of living index" title="Austin, Texas | cost of living index" width="243" height="23"/><plaintext>Austin, Texas | cost of living index</plaintext></subpod></pod><pod title="Result" scanner="Identity" id="Result" position="200" error="false" numsubpods="1" primary="true"><subpod title="" primary="true"><img src="http://www4c.wolframalpha.com/Calculate/MSP/MSP13681gc102ic7534hghc00000i79b03f2bciceg9?MSPStoreType=image/gif&s=58" alt="(data not available)" title="(data not available)" width="127" height="18"/><plaintext>(data not available)</plaintext></subpod></pod><sources count="2"><source url="http://www.wolframalpha.com/sources/CityDataSourceInformationNotes.html" text="City data"/><source url="http://www.wolframalpha.com/sources/RelocationDataSourceInformationNotes.html" text="Relocation data"/></sources><generalization topic="Austin TX" desc="General results for:" url="http://www4c.wolframalpha.com/api/v2/query?id=MSPa13691gc102ic7534hghc00004hg9b7d60de338a0&s=58"/></queryresult>    
POSTED BY: John A
Answer
4 months ago

Group Abstract Group Abstract