Skip to content

Commit

Permalink
fix: encode save file to utf-8
Browse files Browse the repository at this point in the history
  • Loading branch information
stanvanrooy committed Jan 24, 2023
1 parent fc0a966 commit e488219
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions instauto/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def save_to_disk(self, file_name: str, overwrite: bool = False) -> bool:
file_mode = "w" if not overwrite else "w+"

try:
f = open(file_name, file_mode)
f = open(file_name, file_mode, encoding="utf-8")
as_json = self.to_json()
f.write(as_json)
except Exception as e:
Expand All @@ -172,7 +172,7 @@ def save_to_disk(self, file_name: str, overwrite: bool = False) -> bool:

@classmethod
def initiate_from_file(cls, file_name: str) -> "ApiClient":
with open(file_name, "rb") as f:
with open(file_name, "r", encoding="utf-8") as f:
try:
return cls.from_json(f.read())
except orjson.JSONDecodeError:
Expand Down

0 comments on commit e488219

Please sign in to comment.