def get_ipe_graph(conn, graph_id): url = "{}/graph/{}".format(VIRTUAL_IPE_URL, graph_id) req = conn.get(url) if req.status_code == 200: return graph_id else: raise NotFound("No IPE graph found matching id: {}".format(graph_id))
def get_ipe_graph(conn, graph_id): url = "{}/graph/{}".format(VIRTUAL_IPE_URL, graph_id) req = resolve_if_future(conn.get(url)) if req.status_code == 200: return req.json() else: raise NotFound("No IPE graph found matching id: {}".format(graph_id))
def get_graph_stats(conn, graph_id, node_id): url = "{}/metadata/{}/{}/display_stats.json?token={}".format( VIRTUAL_IPE_URL, graph_id, node_id, conn.access_token) req = resolve_if_future(conn.get(url)) if req.status_code == 200: return req.json() else: raise NotFound("Could not fetch stats for graph/node: {} / {}".format( graph_id, node_id))
def get_cached_vrt(idaho_id, node, level): cache_key = vrt_cache_key(idaho_id, node, level) cache_path = os.path.join(IDAHO_CACHE_DIR, cache_key) try: d = os.path.dirname(cache_path) if not os.path.exists(d): mkdir_p(d) with open(cache_path) as f: f.read() return cache_path except IOError: raise NotFound("VRT template for key '{}' not found in cache".format(cache_key))