I can't understand what could be wrong

Here is an example

import csv
import requests
import logging
from datetime import datetime

logging.basicConfig(
filename=“automation.log”,
level=logging.INFO,
format=“%(asctime)s - %(levelname)s - %(message)s”
)

API_URL = “ххх”

def send_payment(transaction):
response = requests.post(API_URL, json=transaction)
return response.status_code == 200

def process_transactions(file_path):
processed_ids = set()

with open(file_path, newline="") as csvfile:
    reader = csv.DictReader(csvfile)

    for row in reader:
        transaction_id = row["id"]

        
        if transaction_id in processed_ids:
            continue

        success = send_payment(row)

        if success:
            logging.info(f"Transaction {transaction_id} processed")
            processed_ids.add(transaction_id)
        else:
            logging.error(f"Transaction {transaction_id} failed")

        return  

if name == “main”:
process_transactions(“transactions.csv”)

1 Like

Welcome to the forum @piter.duran !

Please post a link to this challenge

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.