Compare commits
2 commits
cb4b733bbb
...
77d2fef43a
Author | SHA1 | Date | |
---|---|---|---|
Edward Betts | 77d2fef43a | ||
Edward Betts | 3d8eadb011 |
|
@ -20,6 +20,7 @@ from . import (
|
|||
birthday,
|
||||
calendar,
|
||||
conference,
|
||||
domains,
|
||||
economist,
|
||||
fx,
|
||||
gwr,
|
||||
|
@ -250,6 +251,8 @@ async def get_data(now: datetime) -> typing.Mapping[str, str | object]:
|
|||
events += subscription.get_events(os.path.join(my_data, "subscriptions.yaml"))
|
||||
events += economist.publication_dates(last_week, next_year)
|
||||
|
||||
events += domains.renewal_dates(my_data)
|
||||
|
||||
events.sort(key=operator.attrgetter("as_datetime"))
|
||||
|
||||
observer = sun.bristol()
|
||||
|
|
27
agenda/domains.py
Normal file
27
agenda/domains.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
"""Accomodation."""
|
||||
|
||||
import csv
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
from .types import Event
|
||||
|
||||
url = "https://admin.gandi.net/domain/01578ef0-a84b-11e7-bdf3-00163e6dc886/"
|
||||
|
||||
|
||||
def renewal_dates(data_dir: str) -> list[Event]:
|
||||
"""Get domain renewal dates."""
|
||||
domain_files = [
|
||||
(datetime.strptime(f, "export_domains_%m_%d_%Y_%I_%M_%p.csv"), f)
|
||||
for f in os.listdir(data_dir)
|
||||
if f.startswith("export_domains_")
|
||||
]
|
||||
return [
|
||||
Event(
|
||||
name="domain",
|
||||
title=row["fqdn"],
|
||||
date=datetime.fromisoformat(row["date_registry_end_utc"][:10]).date(),
|
||||
url=url + row["fqdn"],
|
||||
)
|
||||
for row in csv.DictReader(open(os.path.join(data_dir, max(domain_files)[1])))
|
||||
]
|
Loading…
Reference in a new issue