Last active
December 4, 2020 13:11
-
-
Save one-data-cookie/e419d680755e2e64945085090488f735 to your computer and use it in GitHub Desktop.
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
import requests as rq | |
import pandas as pd | |
channel_url = 'https://slack.com/api/conversations.list' | |
channel_headers = {'content-type': 'application/x-www-form-urlencoded'} | |
channel_params = { | |
'token': 'xoxp-XXXXXXXXXXXX-XXXXXXXXXXXX-XXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', | |
'limit': 1000, | |
'exclude_archived': True | |
} | |
channel_res = rq.get(url=channel_url, headers=channel_headers, params=channel_params) | |
channel_data = [] | |
for i in channel_res.json()['channels']: | |
channel_data.append({ | |
'id': i['id'], | |
'name': i['name'], | |
'created': i['created'], | |
'members': i['num_members'], | |
'is_group': i['is_group'] | |
}) | |
channel_df = pd.DataFrame(channel_data).sort_values('members', ascending=False) | |
print(channel_df) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment