Should not urlencode params
riley-martine opened this issue · comments
Riley Martine commented
I want to get the step-by-step solution for a problem. My real query that works via curl looks like this:
When I use the code
equation = "11x+18=172"
params = (
('podstate', 'Solution__Step-by-step+solution'),
)
res = client.query(f"{equation}", params=params)
I get the query
https://api.wolframalpha.com/v2/query?podstate=Solution__Step-by-step%2Bsolution&input=11x%2B18%3D172&appid=XXX
This urlencodes the '+' in Solution__Step-by-step+solution
and the parameter fails to resolve.
You can test the difference with
APPID=YOUR_APP_ID
curl "https://api.wolframalpha.com/v2/query?podstate=Solution__Step-by-step+solution&input=11x%2B18%3D172&appid=$APPID" > manual
curl "https://api.wolframalpha.com/v2/query?podstate=Solution__Step-by-step%2Bsolution&input=11x%2B18%3D172&appid=$APPID" > auto
diff manual auto
Jason R. Coombs commented
Im pretty sure the issue you have here is the plus is already encoded so is getting double encoded. I suspect all you need to do is put a space where that plus is and let the encoding happen by the library as it should. See this question for more info.