SHARE
TWEET

Untitled

a guest Jul 24th, 2019 112 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def login_sales_navigator():
  2.     s = requests.Session()
  3.     main_data = grab_session_data()
  4.     sess_cookies = main_data['cookies']
  5.     sess_response = main_data['response']
  6.     headers = {
  7.         'authority': 'www.linkedin.com',
  8.         'pragma': 'no-cache',
  9.         'cache-control': 'no-cache',
  10.         'origin': 'https://www.linkedin.com',
  11.         'upgrade-insecure-requests': '1',
  12.         'dnt': '1',
  13.         'content-type': 'application/x-www-form-urlencoded',
  14.         'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36',
  15.         'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
  16.         'referer': 'https://www.linkedin.com/uas/login?session_redirect=%2Fsales&fromSignIn=true&trk=navigator',
  17.         'accept-encoding': 'gzip, deflate, br',
  18.         'accept-language': 'en-US,en;q=0.9',
  19.         'cookie': sess_cookies
  20.     }
  21.     data = main_data['form']
  22.     response = s.post('https://www.linkedin.com/checkpoint/lg/login-submit', headers=headers, data=data, allow_redirects=False)
  23.     accepted_cookies = 'JSESSIONID="{}"; bcookie="{}"; bscookie="{}"; lissc1=1; lissc2=1; li_at="{}"; liap=true; sl=v=1&2fsuB; lang=v=2&lang=en-us; lidc="{}"; chp_token={}'.format(sess_response.cookies.get('JSESSIONID'), sess_response.cookies.get("bcookie"), sess_response.cookies.get('bscookie'), response.cookies.get('li_at'), sess_response.cookies.get('lidc'), response.cookies.get('chp_token'))
  24.     #try:
  25.     print("response cookies....z", response.cookies)
  26.  
  27.     if response.cookies.get('JSESSIONID') == None:
  28.         cookies_csrf = sess_response.cookies.get('JSESSIONID')
  29.     else:
  30.         cookies_csrf = response.cookies.get('JSESSIONID')
  31.     core_cookies = fetch_core_cookies(accepted_cookies, cookies_csrf)
  32.     headers['cookie'] = core_cookies
  33.  
  34.     store_header(headers)
  35.     return visit_sales_page(headers)
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