from pathlib import Path import json from dataclasses import dataclass @dataclass class GoDaddyCreds: key: str secret: str @classmethod def from_json(cls, path:Path=Path('creds.json')) -> 'GoDaddyCreds': with open(path, 'r') as jfile: creds = json.load(jfile) return GoDaddyCreds(**creds)