Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
[fix] unicode error with WolframAlpha API engine
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcAbonce committed Jan 9, 2019
1 parent 2438b3c commit 626a8e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion searx/engines/wolframalpha_api.py
Expand Up @@ -65,7 +65,7 @@ def replace_pua_chars(text):
def response(resp):
results = []

search_results = etree.XML(resp.text)
search_results = etree.XML(resp.content)

# return empty array if there are no results
if search_results.xpath(failure_xpath):
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/engines/test_wolframalpha_api.py
Expand Up @@ -35,7 +35,7 @@ def test_response(self):
xml = '''<?xml version='1.0' encoding='UTF-8'?>
<queryresult success='false' error='false' />
'''
response = mock.Mock(text=xml.encode('utf-8'))
response = mock.Mock(content=xml.encode('utf-8'))
self.assertEqual(wolframalpha_api.response(response), [])

# test basic case
Expand Down Expand Up @@ -83,7 +83,7 @@ def test_response(self):
</pod>
</queryresult>
"""
response = mock.Mock(text=xml, request=request)
response = mock.Mock(content=xml, request=request)
results = wolframalpha_api.response(response)
self.assertEqual(type(results), list)
self.assertEqual(len(results), 2)
Expand Down Expand Up @@ -144,7 +144,7 @@ def test_response(self):
</pod>
</queryresult>
"""
response = mock.Mock(text=xml, request=request)
response = mock.Mock(content=xml, request=request)
results = wolframalpha_api.response(response)
self.assertEqual(type(results), list)
self.assertEqual(len(results), 2)
Expand Down

0 comments on commit 626a8e9

Please sign in to comment.