Created
March 31, 2017 01:29
-
-
Save plasx/d8c7e082301e2c2c7747f6f4dcaa6c19 to your computer and use it in GitHub Desktop.
linkedin login bs4
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 | |
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