all repos — janny @ b5e067ac1e28790ab3330714a2a014d0a7160dc5

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
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