Created
February 3, 2023 15:27
-
-
Save damieng/3f479809f2c9549ddba81e40291441a8 to your computer and use it in GitHub Desktop.
Process Slack Invite JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from collections import defaultdict | |
from json import loads | |
from sys import argv, stdin | |
from pprint import pprint | |
inviters = defaultdict(list) | |
for invite in loads(stdin.read()): | |
inviters[invite['invitedBy']].append(invite['user']) | |
print('digraph D {') | |
for user, invitees in inviters.items(): | |
print(f' {user}') | |
for invitee in invitees: | |
print(f' {user} -> {invitee}') | |
print('') | |
print('}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment