Created
December 30, 2015 01:50
-
-
Save matthewmayer/ce5cac155260cbb17aa8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
import json | |
import calendar | |
from datetime import datetime, timedelta | |
#lists all files above 10MB in your slack files repo | |
#based on https://www.shiftedup.com/2014/11/13/how-to-bulk-remove-files-from-slack | |
_token = "" | |
_domain = "" | |
if __name__ == '__main__': | |
page = 1 | |
MB = 1000000 | |
while 1: | |
files_list_url = 'https://slack.com/api/files.list' | |
data = {"token": _token, "page": page} | |
response = requests.post(files_list_url, data = data) | |
if len(response.json()["files"]) == 0: | |
break | |
for f in response.json()["files"]: | |
if f['size']>10*MB: | |
print "%s (%s MB)" % (f['permalink'], f['size']/MB) | |
page = page+1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment