all repos — janny @ 037e9700cfe4f2c8f310ed9652a241d3c7c9d5cf

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