Browse Source

fix bug with ecncoding

Alex Sidorov 1 năm trước cách đây
mục cha
commit
553fe10a84
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      data_employee.py

+ 3 - 3
data_employee.py

@@ -98,10 +98,10 @@ class DataEmployee:
         for link_api in self.create_links_api():
         for link_api in self.create_links_api():
             response = requests.get(link_api)
             response = requests.get(link_api)
             try:
             try:
-                data.append(json.loads(response.text))
+                data.append(response.json())
             except json.decoder.JSONDecodeError:
             except json.decoder.JSONDecodeError:
-                response.encoding = 'utf-8-sig'
-                data.append(json.loads(response.text))
+                result = str(response.text).encode('utf-8-sig').decode('utf-8-sig')
+                data.append(json.loads(result.encode('utf-8')))
 
 
         return data
         return data