Skip to content

Instantly share code, notes, and snippets.

@plasx
Created March 31, 2017 01:29
Show Gist options
  • Save plasx/d8c7e082301e2c2c7747f6f4dcaa6c19 to your computer and use it in GitHub Desktop.
Save plasx/d8c7e082301e2c2c7747f6f4dcaa6c19 to your computer and use it in GitHub Desktop.
linkedin login bs4
import requests
from bs4 import BeautifulSoup
client = requests.Session()
HOMEPAGE_URL = 'https://www.linkedin.com?allowUnsupportedBrowser=true'
LOGIN_URL = 'https://www.linkedin.com/uas/login-submit?allowUnsupportedBrowser=true'
html = client.get(HOMEPAGE_URL).content
soup = BeautifulSoup(html)
csrf = soup.find(id="loginCsrfParam-login")['value']
login_information = {
'session_key':'username',
'session_password':'password!',
'loginCsrfParam': csrf,
}
client.post(LOGIN_URL, data=login_information)
x = client.get('http://www.linkedin.com/messaging/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment