parent
1e90df76dd
commit
422cd8aa9d
|
@ -23,6 +23,7 @@ from . import (
|
||||||
conference,
|
conference,
|
||||||
domains,
|
domains,
|
||||||
economist,
|
economist,
|
||||||
|
gandi,
|
||||||
gwr,
|
gwr,
|
||||||
hn,
|
hn,
|
||||||
holidays,
|
holidays,
|
||||||
|
@ -38,6 +39,7 @@ from . import (
|
||||||
)
|
)
|
||||||
from .types import Event, StrDict, Trip
|
from .types import Event, StrDict, Trip
|
||||||
|
|
||||||
|
|
||||||
here = dateutil.tz.tzlocal()
|
here = dateutil.tz.tzlocal()
|
||||||
|
|
||||||
# deadline to file tax return
|
# deadline to file tax return
|
||||||
|
@ -449,6 +451,7 @@ async def get_data(
|
||||||
events += results[key]
|
events += results[key]
|
||||||
events += read_events_yaml(my_data, last_year, next_year)
|
events += read_events_yaml(my_data, last_year, next_year)
|
||||||
events += subscription.get_events(os.path.join(my_data, "subscriptions.yaml"))
|
events += subscription.get_events(os.path.join(my_data, "subscriptions.yaml"))
|
||||||
|
events += gandi.get_events(data_dir)
|
||||||
events += economist.publication_dates(last_week, next_year)
|
events += economist.publication_dates(last_week, next_year)
|
||||||
events += meetup.get_events(my_data)
|
events += meetup.get_events(my_data)
|
||||||
events += hn.whoishiring(last_year, next_year)
|
events += hn.whoishiring(last_year, next_year)
|
||||||
|
|
26
agenda/gandi.py
Normal file
26
agenda/gandi.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
"""Gandi domain renewal dates."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
from .types import Event
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
def get_events(data_dir: str) -> list[Event]:
|
||||||
|
"""Get subscription renewal dates."""
|
||||||
|
filename = os.path.join(data_dir, "gandi_domains.json")
|
||||||
|
|
||||||
|
with open(filename) as f:
|
||||||
|
items = json.load(f)
|
||||||
|
|
||||||
|
assert isinstance(items, list)
|
||||||
|
assert all(item["fqdn"] and item["dates"]["registry_ends_at"] for item in items)
|
||||||
|
|
||||||
|
return [
|
||||||
|
Event(
|
||||||
|
date=item["dates"]["registry_ends_at"],
|
||||||
|
name="domain",
|
||||||
|
title=item["fqdn"] + " renewal",
|
||||||
|
)
|
||||||
|
for item in items
|
||||||
|
]
|
15
update.py
15
update.py
|
@ -18,6 +18,7 @@ import agenda.uk_holiday
|
||||||
import agenda.waste_schedule
|
import agenda.waste_schedule
|
||||||
from agenda import gwr
|
from agenda import gwr
|
||||||
|
|
||||||
|
|
||||||
config = __import__("config.default", fromlist=[""])
|
config = __import__("config.default", fromlist=[""])
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,6 +108,20 @@ def update_thespacedevs() -> None:
|
||||||
print(f"took {time_taken:.1f} seconds")
|
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:
|
def main() -> None:
|
||||||
"""Update caches."""
|
"""Update caches."""
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
|
|
Loading…
Reference in a new issue