Whole code
from bs4 import BeautifulSoup
import requests
import re
TEAM_NAME = "hoge"
payload = {
'signin': "1",
'email': 'email',
'password': 'password'
}
login_url = 'https://%s.slack.com/' % TEAM_NAME
#Access the login page
session = requests.Session()
response = session.get(login_url)
#Get crumb
bs = BeautifulSoup(response.text)
auth_token = bs.find(attrs={'name': 'crumb'}).get('value')
payload['crumb'] = auth_token
#log in
session.post(login_url, data=payload)
Recommended Posts