Skip to content

Commit f0584a8

Browse files
committed
Refactor code to improve picture import process
1 parent d008f90 commit f0584a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/import_pictures.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ async def send_request(session, url, json):
6161

6262
async def process_data(data, file, session):
6363
files = []
64-
print(f"Processing {file}")
64+
print(f"Processing pictures {file}")
6565

6666
for entry in data:
6767
with open(f'./cache/pictures/files/{entry["ident"]}.jpg', 'rb') as fichier:
68+
print(f"Reading picture {entry['ident']}.jpg")
6869
picture = fichier.read()
6970
files.append({
7071
"id": entry["ident"].split('-')[1],
@@ -73,7 +74,7 @@ async def process_data(data, file, session):
7374

7475
tasks = [send_request(session, f'{sesame_api_baseurl}/management/identities/upsert/photo', part) for part in files]
7576
await gather_with_concurrency(sesame_import_parallels_files, tasks)
76-
print(f"Processed {file}")
77+
print(f"Processed pictures {file}")
7778

7879
def list_files_in_dir(directory):
7980
files = [f for f in os.listdir(directory) if os.path.isfile(os.path.join(directory, f))]

0 commit comments

Comments
 (0)