|
7 | 7 | import pandas as pd
|
8 | 8 | import requests
|
9 | 9 |
|
| 10 | +__all__ = ["save_xml", "read_rates", "available_years"] |
| 11 | + |
10 | 12 | BC_KEYS = [
|
11 | 13 | "BC_1MONTH",
|
12 | 14 | "BC_3MONTH",
|
@@ -72,30 +74,16 @@ def filepath(year: int, folder=None):
|
72 | 74 | return os.path.join(folder, filename)
|
73 | 75 |
|
74 | 76 |
|
75 |
| -def read_local_xml(year): |
76 |
| - return read(path=filepath(year)) |
77 |
| - |
78 |
| - |
79 | 77 | def read(path):
|
80 | 78 | with open(path, "r") as f:
|
81 | 79 | return f.read()
|
82 | 80 |
|
83 | 81 |
|
84 |
| -def save_local_xml(year: int, content: str): |
85 |
| - path = filepath(year) |
86 |
| - save(path, content) |
87 |
| - |
88 |
| - |
89 | 82 | def save(path: str, content: str):
|
90 | 83 | with open(path, "w") as f:
|
91 | 84 | f.write(content)
|
92 | 85 |
|
93 | 86 |
|
94 |
| -def save_year(year: int): |
95 |
| - content = get_xml_content_from_web(year) |
96 |
| - save_local_xml(year, content) |
97 |
| - |
98 |
| - |
99 | 87 | def rates(year):
|
100 | 88 | """Return Rates(year) for default location."""
|
101 | 89 | return Rates(year, default_folder())
|
@@ -161,11 +149,6 @@ def elem(datum, key):
|
161 | 149 | return 0
|
162 | 150 |
|
163 | 151 |
|
164 |
| -def save_datapoints_from_web(year): |
165 |
| - xml_content = get_xml_content_from_web(year) |
166 |
| - save_local_xml(year, xml_content) |
167 |
| - |
168 |
| - |
169 | 152 | def to_dataframe(gen):
|
170 | 153 | df = pd.DataFrame(gen)[DF_COLUMNS]
|
171 | 154 | df["date"] = pd.to_datetime(df["date"])
|
|
0 commit comments