parent
1e90df76dd
commit
422cd8aa9d
3 changed files with 44 additions and 0 deletions
15
update.py
15
update.py
|
|
@ -18,6 +18,7 @@ import agenda.uk_holiday
|
|||
import agenda.waste_schedule
|
||||
from agenda import gwr
|
||||
|
||||
|
||||
config = __import__("config.default", fromlist=[""])
|
||||
|
||||
|
||||
|
|
@ -107,6 +108,20 @@ def update_thespacedevs() -> None:
|
|||
print(f"took {time_taken:.1f} seconds")
|
||||
|
||||
|
||||
def update_gandi() -> None:
|
||||
"""Retrieve list of domains from gandi.net."""
|
||||
url = "https://api.gandi.net/v5/domain/domains"
|
||||
headers = {"authorization": "Bearer " + config.GANDI_TOKEN}
|
||||
filename = os.path.join(config.DATA_DIR, "gandi_domains.json")
|
||||
|
||||
r = requests.request("GET", url, headers=headers)
|
||||
items = r.json()
|
||||
assert isinstance(items, list)
|
||||
assert all(item["fqdn"] and item["dates"]["registry_ends_at"] for item in items)
|
||||
with open(filename, "w") as out:
|
||||
out.write(r.text)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Update caches."""
|
||||
now = datetime.now()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue