aboutsummaryrefslogtreecommitdiffstats
path: root/fnme/data.py
blob: 369d80f50014e60f5f878ace5e575d0ba9fed218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
from io import StringIO
from typing import Optional

import pandas as pd
import requests
from constants import ENDPOINT, HEADERS


def get_latest_data() -> tuple[pd.DataFrame, Optional[str]]:
    response = requests.get(ENDPOINT, headers=HEADERS, timeout=10)
    response.raise_for_status()
    return pd.read_csv(StringIO(response.text)), response.headers.get("Last-Modified")
git.ajschof.me — hosted by ajschofield — powered by cgit