def cluster_egonet(currency, cluster): direction = request.args.get("direction") if not cluster: abort(404, "Cluster not provided") try: cluster = int(cluster) cluster = str(cluster) except Exception: abort(404, "Invalid cluster ID") if not direction: direction = "" limit = request.args.get("limit") if not limit: limit = 50 else: try: limit = int(limit) except Exception: abort(404, "Invalid limit value") try: egoNet = gm.ClusterEgoNet( gd.query_cluster(currency, cluster), gd.query_cluster_tags(currency, cluster), gd.query_cluster_incoming_relations(currency, cluster, int(limit)), gd.query_cluster_outgoing_relations(currency, cluster, int(limit))) ret = egoNet.construct(cluster, direction) except Exception: ret = {} return jsonify(ret)
def address_cluster_with_tags(currency, address): if not address: abort(404, "Address not provided") address_cluster = gd.query_address_cluster(currency, address) if "cluster" in address_cluster: address_cluster["tags"] = gd.query_cluster_tags( currency, address_cluster["cluster"]) return jsonify(address_cluster)
def cluster_tags(currency, cluster): if not cluster: abort(404, "Cluster not provided") try: cluster = int(cluster) except Exception: abort(404, "Invalid cluster ID") tags = gd.query_cluster_tags(currency, cluster) return jsonify(tags)
def get(self, currency, cluster): """ Returns a JSON with the tags of the cluster """ if not cluster: abort(404, "Cluster id not provided") cluster_obj = gd.query_cluster(currency, cluster) if not cluster_obj: abort(404, "Cluster not found") cluster_obj.tags = gd.query_cluster_tags(currency, cluster) return cluster_obj
def get(self, currency, address): """ Returns a JSON with edges and nodes of the address """ if not address: abort(404, "Address not provided") address_cluster = gd.query_address_cluster(currency, address) if "cluster" in address_cluster: address_cluster["tags"] = gd.query_cluster_tags( currency, address_cluster["cluster"]) return address_cluster
def get(self, currency, cluster): """ Returns a JSON with the tags of the cluster """ if not cluster: abort(404, "Cluster not provided") try: cluster = int(cluster) except Exception: abort(404, "Invalid cluster ID") tags = gd.query_cluster_tags(currency, cluster) return tags
def get(self, currency, cluster): """ Returns a JSON with the tags of the cluster """ if not cluster: abort(404, "Cluster not provided") try: cluster = int(cluster) except Exception: abort(404, "Invalid cluster ID") tags = gd.query_cluster_tags(currency, cluster) return Response(tagsToCSV(tags), mimetype="text/csv")
def cluster_with_tags(currency, cluster): if not cluster: abort(404, "Cluster id not provided") cluster_obj = gd.query_cluster(currency, cluster) cluster_obj.tags = gd.query_cluster_tags(currency, cluster) return jsonify(cluster_obj.__dict__) if cluster_obj else jsonify({})