diff --git a/csv_exporter.py b/csv_exporter.py index dab9a77..7c3ccb0 100644 --- a/csv_exporter.py +++ b/csv_exporter.py @@ -1,6 +1,6 @@ from verein import Verein -TABLE_HEADING = "account_name,total_balance,available_balance,redeemed" +TABLE_HEADING = "account_name,address,post_code,city,total_balance,available_balance,redeemed" def export_vereine(vereine: [Verein], export_filename: str): @@ -13,4 +13,5 @@ def export_vereine(vereine: [Verein], export_filename: str): def line_for_verein(verein: Verein): - return f'{verein.account_name},{verein.total_balance},{verein.available_balance},{verein.redeemed}' + return f'"{verein.account_name}","{verein.address}",{verein.post_code},"{verein.city}",' \ + f'{verein.total_balance},{verein.available_balance},{verein.redeemed}' diff --git a/verein.py b/verein.py index a2e9cba..9fec967 100644 --- a/verein.py +++ b/verein.py @@ -1,11 +1,18 @@ class Verein: account_name: str + address: str + post_code: int + city: str total_balance: int available_balance: int redeemed: int - def __init__(self, account_name: str, total_balance: int, available_balance: int, redeemed: int): + def __init__(self, account_name: str, address: str, city: str, post_code: int, total_balance: int, + available_balance: int, redeemed: int): self.account_name = account_name + self.address = address + self.post_code = post_code + self.city = city self.total_balance = total_balance self.available_balance = available_balance self.redeemed = redeemed diff --git a/verein_fetcher.py b/verein_fetcher.py index a05d2ff..df9b5db 100644 --- a/verein_fetcher.py +++ b/verein_fetcher.py @@ -20,4 +20,6 @@ def get_verein_for_id(verein_id: int) -> Verein: raise RuntimeError data = response.json()['data'] - return Verein(data['accountName'], data['totalBalance'], data['availableBalance'], data['redeemed']) + address = data['address'] + return Verein(data['accountName'], address['address'], address['city'], address['postCode'], data['totalBalance'], + data['availableBalance'], data['redeemed'])