notebook
This commit is contained in:
28
10 FioAPI.py
28
10 FioAPI.py
@@ -1,24 +1,24 @@
|
||||
import requests
|
||||
import json
|
||||
from datetime import date, timedelta
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
|
||||
# Replace with your actual token
|
||||
API_TOKEN = "v0GJaAVeefzV1lnx1jPCf2nFF7SuOPzzrL5tobPNsC7oCChXG4hahDYVb8Rdcex0"
|
||||
load_dotenv()
|
||||
|
||||
# Example: download last 30 days of transactions in JSON
|
||||
url = f"https://fioapi.fio.cz/v1/rest/periods/v0GJaAVeefzV1lnx1jPCf2nFF7SuOPzzrL5tobPNsC7oCChXG4hahDYVb8Rdcex0/2000-01-01/2025-07-23/transactions.json"
|
||||
API_TOKEN = os.getenv("FIO_TOKEN")
|
||||
|
||||
|
||||
# Last 30 days
|
||||
start = (date.today() - timedelta(days=10000)).strftime("%Y-%m-%d")
|
||||
end = date.today().strftime("%Y-%m-%d")
|
||||
|
||||
url = f"https://fioapi.fio.cz/v1/rest/periods/{API_TOKEN}/{start}/{end}/transactions.json"
|
||||
|
||||
response = requests.get(url)
|
||||
print(response)
|
||||
print(response.status_code)
|
||||
|
||||
data = response.json()
|
||||
|
||||
with open(r"u:\Dropbox\!!!Days\Downloads Z230\Fio\pohyby.json", "w", encoding="utf-8") as f:
|
||||
json.dump(data, f, ensure_ascii=False, indent=4)
|
||||
#
|
||||
# # Print some info
|
||||
# for trans in data['accountStatement']['transactionList']['transaction']:
|
||||
# print(f"Date: {trans['column0']['value']}")
|
||||
# print(f"Amount: {trans['column1']['value']}")
|
||||
# print(f"Currency: {trans['column14']['value']}")
|
||||
# print(f"Sender/Receiver: {trans['column10']['value']}")
|
||||
# print(f"Message: {trans['column16']['value']}")
|
||||
# print("-" * 40)
|
||||
|
||||
Reference in New Issue
Block a user