22 lines
501 B
Python
22 lines
501 B
Python
import os
|
|
import sys
|
|
import firefly.budgets
|
|
import firefly.accounts
|
|
|
|
from flask import Flask
|
|
|
|
|
|
if 'FIREFLY_PERSONAL_ACCESS_TOKEN' not in os.environ:
|
|
print("Please set $FIREFLY_PERSONAL_ACCESS_TOKEN in environment")
|
|
sys.exit(1)
|
|
if 'FIREFLY_API_HOST' not in os.environ:
|
|
print("Please set $FIREFLY_API_HOST in environment")
|
|
sys.exit(1)
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
@app.route('/metrics')
|
|
def metric():
|
|
return firefly.budgets.get_budget_metrics() + firefly.accounts.get_account_metrics()
|