daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from slackclient import SlackClient
  2. from datetime import datetime, timedelta
  3.  
  4. slack_token = 'slacktoken'
  5.  
  6. d = datetime.today() - timedelta(days=2)
  7. d = d.strftime('%s')
  8.  
  9. slack = SlackClient(slack_token)
  10. users = slack.api_call("users.list")['members']
  11.  
  12. print('GONE USERS')
  13.  
  14. all_users = newlist = sorted(users, key=lambda k: k['updated'])
  15. for user in all_users:
  16.     if user['deleted'] and int(user['updated']) < int(d) and not user['is_bot']:
  17.         cut_date = datetime.fromtimestamp(int(user['updated'])).strftime('%m-%d-%Y')
  18.         print(f"{user['profile']['real_name']} - {cut_date}")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top