btrunghieu commited on
Commit
c19432e
1 Parent(s): 45d9117

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -25,10 +25,14 @@ client = AsyncClient(
25
  )
26
 
27
  def parse_comments(response: Response) -> Dict:
 
 
 
28
  try:
 
29
  data = json.loads(response.text)
30
- except json.JSONDecodeError:
31
- log.error(f"Failed to parse JSON response: {response.text}")
32
  return {"comments": [], "total_comments": 0}
33
 
34
  comments_data = data.get("comments", [])
 
25
  )
26
 
27
  def parse_comments(response: Response) -> Dict:
28
+ log.debug(f"Response status code: {response.status_code}")
29
+ log.debug(f"Response headers: {response.headers}")
30
+
31
  try:
32
+ response.encoding = 'utf-8'
33
  data = json.loads(response.text)
34
+ except json.JSONDecodeError as e:
35
+ log.error(f"Failed to parse JSON response: {e}")
36
  return {"comments": [], "total_comments": 0}
37
 
38
  comments_data = data.get("comments", [])