Skip to content

Instantly share code, notes, and snippets.

Last active Dec 8, 2017
What would you like to do?
from rx import Observable, Observer
def getAggregation(transaction, aggName):
return Observable.from_(transaction[aggName]["buckets"])
getAggregation(res["aggregations"],"transactions") \
.flat_map(lambda transaction : getAggregation(transaction, 'BySourceAddress').map(lambda b: (transaction["key"],b) ) ) \
.flat_map(lambda transaction : getAggregation(transaction[1], 'ByASN').map(lambda b: (transaction[0],transaction[1]["key"],b) ) ) \
.flat_map(lambda transaction : getAggregation(transaction[2], 'ByDestPort').map(lambda b: (transaction[0],transaction[1],transaction[2]["key"],b) ) ) \
.map(lambda t : (t[0], t[1],t[2], t[3]["key"])) \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment