Skip to content

Commit

Permalink
fix: replace file.read by file directly in add_folder
Browse files Browse the repository at this point in the history
  • Loading branch information
CorentinHrflow committed Mar 12, 2024
1 parent 7a6eb3b commit 9a3e144
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions hrflow/profile/parsing.py
Expand Up @@ -144,16 +144,15 @@ def add_folder(
for file_path in files_to_send:
filename = os.path.basename(file_path)
try:
with open(file_path, "rb") as f:
profile_file = f.read()
resp = self.add_file(
source_key=source_key,
profile_file=profile_file,
profile_file_name=filename,
created_at=created_at,
sync_parsing=sync_parsing,
**kwargs,
)
with open(file_path, "rb") as file:
resp = self.add_file(
source_key=source_key,
profile_file=file,
profile_file_name=filename,
created_at=created_at,
sync_parsing=sync_parsing,
**kwargs,
)
response_code = str(resp["code"]) # 200, 201, 202, 400, ...
if response_code[0] != "2":
failed_upload[file_path] = ValueError(
Expand Down

0 comments on commit 9a3e144

Please sign in to comment.