Create fetch_data.py
Browse files- fetch_data.py +15 -0
fetch_data.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
import pandas as pd
|
3 |
+
from io import BytesIO
|
4 |
+
from Utils.config import DATASET_URLS
|
5 |
+
|
6 |
+
def fetch_real_data(domain):
|
7 |
+
url = DATASET_URLS.get(domain)
|
8 |
+
if not url:
|
9 |
+
raise ValueError(f"No URL found for domain: {domain}")
|
10 |
+
|
11 |
+
response = requests.get(url)
|
12 |
+
response.raise_for_status()
|
13 |
+
|
14 |
+
df = pd.read_csv(BytesIO(response.content))
|
15 |
+
return df
|