Skip to content
Snippets Groups Projects
Commit 2cf6f656 authored by Leo Pellandini's avatar Leo Pellandini
Browse files

correction

parent 88949b8e
No related branches found
No related tags found
No related merge requests found
...@@ -13,16 +13,15 @@ def create_bucket(gcp_client, bucket_name): ...@@ -13,16 +13,15 @@ def create_bucket(gcp_client, bucket_name):
bucket = gcp_client.create_bucket(bucket_name) bucket = gcp_client.create_bucket(bucket_name)
# Function to write files to S3
def write_files(gcp_client, directory, bucket): def write_files(gcp_client, directory, bucket):
bucket = gcp_client.bucket(bucket) bucket = gcp_client.bucket(bucket)
for filename in os.listdir(directory): for filename in os.listdir(directory):
if filename.endswith(".pdf"): # Check if the file is a PDF if filename.endswith(".pdf"): # Vérifie si c'est un fichier PDF
file_path = os.path.join(directory, filename) file_path = os.path.join(directory, filename) # Crée le chemin complet vers le fichier
with open(file_path, 'rb') as file: with open(file_path, 'rb') as file:
print(f"Uploading {filename} to bucket {bucket}...") print(f"Uploading {filename} to bucket {bucket}...")
blob = bucket.blob(filename) blob = bucket.blob(filename)
blob.upload_from_filename(filename) blob.upload_from_filename(file_path) # Utilise le chemin complet ici
print(f"{filename} uploaded successfully.") print(f"{filename} uploaded successfully.")
def main(bucket_name, local_dir): def main(bucket_name, local_dir):
......
File added
File added
[aws] [aws]
aws_access_key_id = aws_access_key_id = AKIAVEKYIBTQMWQQUPM4
aws_secret_access_key = aws_secret_access_key = 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
region = region = us-east-1
[opensearch] [opensearch]
endpoint = endpoint = 6oi83zhfbs2kidzcr2a4.us-east-1.aoss.amazonaws.com
index_name = index_name = firstpdfgroupe4
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment