第21天:使用 Python 获取银行交易(Plaid & Wise)
发布: (2026年1月18日 GMT+8 01:50)
1 min read
原文: Dev.to
Source: Dev.to
金融科技应用的真实数据
欢迎来到第 21 天。
在构建金融科技应用吗?你需要真实的交易数据。今天我为我的金融代理构建了数据摄取引擎。
环境搭建
依赖
pip install plaid-python requests
模拟(Plaid)
Plaid Sandbox 让你模拟用户登录银行(例如 “Platypus Bank”),并返回真实的交易数据。
# Creating a fake public token
pt_request = SandboxPublicTokenCreateRequest(
institution_id='ins_109508',
initial_products=[Products('transactions')]
)
# Exchanging it for an Access Token
exchange_response = client.item_public_token_exchange(exchange_request)
实际(Wise)
对于个人项目,Wise 提供了便利的 Personal Token API。
import requests
headers = {"Authorization": f"Bearer {WISE_API_TOKEN}"}
response = requests.get("https://api.wise.com/v1/profiles", headers=headers)
教训
始终在 macOS 的 Python 环境中处理 SSL 证书!如果遇到 SSL: CERTIFICATE_VERIFY_FAILED,请运行位于 Python 安装文件夹中的 Install Certificates.command 脚本。
