all repos — janny @ bcfc8d6f2d4205994e1cf0889d7b05cbc540f147

clean up Kubernetes resources after a set TTL

janny/utils.py (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
import logging
import json
from types import SimpleNamespace

from janny.config import API_HOST
from janny.auth import SESSION


def get(path):
    """Convert a JSON response into a Python object"""
    s = SESSION
    data = s.get(API_HOST + path).content
    obj = json.loads(data, object_hook=lambda d: SimpleNamespace(**d))
    return obj