Prechádzať zdrojové kódy

fix bug with ecncoding

Alex Sidorov 1 rok pred
rodič
commit
553fe10a84
1 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  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():
             response = requests.get(link_api)
             try:
-                data.append(json.loads(response.text))
+                data.append(response.json())
             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