Skip to content

Commit

Permalink
Update station-maintenance-aggregated.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianosticca-pagopa authored Jan 16, 2025
1 parent 6cfee87 commit a59c252
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/main/scripts/station-maintenance-aggregated.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,23 @@ def get_pa_for_broker(broker_code):
}

all_creditor_institutions = []

while True:
params = {'page': page, 'limit': limit}
response = requests.get(base_url, headers=headers, params=params)
response.raise_for_status()

data = response.json()
creditor_institutions = data.get('creditorInstitutions', [])
all_creditor_institutions.extend(creditor_institutions)

all_creditor_institutions.extend(data['creditorInstitutions'])

total_pages = data.get('pageInfo', {}).get('totalPages', 1)
if page >= total_pages - 1:
# Verifica se siamo arrivati all'ultima pagina
if len(data['creditorInstitutions']) < limit:
break
page += 1

return all_creditor_institutions
# Restituire la struttura originale
return {
'creditorInstitutions': all_creditor_institutions
}


def create_betterstack_maintenance(data):
Expand Down

0 comments on commit a59c252

Please sign in to comment.