Skip to content

Commit

Permalink
fix(tpc_manager): decoding latin1 instead of utf-8
Browse files Browse the repository at this point in the history
  • Loading branch information
valearna committed Mar 5, 2021
1 parent 1e7231d commit 57e3420
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/tpcmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def get_papers(self, keywords: List[str], case_sensitive: bool = True, year: str
req = urllib.request.Request(self.tpc_api_endpoint, data, headers={'Content-type': 'application/json',
'Accept': 'application/json'})
logger.debug("Sending request to Textpresso Central API")
results = json.loads(urllib.request.urlopen(req).read().decode('utf-8'))
results = json.loads(urllib.request.urlopen(req).read().decode('latin1'))
if results:
papers.extend(results)
if not results or len(results) < 200:
Expand Down Expand Up @@ -111,7 +111,7 @@ def get_category_matches(self, keywords: List[str], case_sensitive: bool = True,
req = urllib.request.Request(self.tpc_category_matches_endpoint, data,
headers={'Content-type': 'application/json', 'Accept': 'application/json'})
logger.debug("Sending request to Textpresso Central API")
res = json.loads(urllib.request.urlopen(req).read().decode('utf-8'))
res = json.loads(urllib.request.urlopen(req).read().decode('latin1'))
if lower:
for idx, p in enumerate(res):
if 'matches' in p:
Expand Down

0 comments on commit 57e3420

Please sign in to comment.