aboutsummaryrefslogtreecommitdiffstats
path: root/fnme/data.py
diff options
context:
space:
mode:
Diffstat (limited to 'fnme/data.py')
-rw-r--r--fnme/data.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/fnme/data.py b/fnme/data.py
new file mode 100644
index 0000000..bdec6df
--- /dev/null
+++ b/fnme/data.py
@@ -0,0 +1,13 @@
+from io import StringIO
+from typing import Optional
+
+import pandas as pd
+import requests
+
+from fnme.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