无法使用请求登录到顽固的站点

I'm trying to log into a website using requests module. To reach the log in page it is necessary to click on the Jetzt bewerben button from this webpage. There are two buttons having the same name (Jetzt bewerben) in there. However, you can land in the log in page clicking on either of them. Once you click on the button, you should see the log in page which looks like image of the log in page. This is a demo username asmshahin80@gmail.com and a password SShift_12345 for you to test.

我尝试过:

import requests
from bs4 import BeautifulSoup

base = 'https://career5.successfactors.eu{}'
main_url = 'https://jobs.deloitte.de/job/D%C3%BCsseldorf-Sch%C3%BClerpraktikant-%28mwd%29-Informatik/545677801/'
first_post = 'https://career5.successfactors.eu/careers'

login_url = 'https://career5.successfactors.eu/career?_s.crb={}'

payload = {
    'correlation_Id': '14151453801',
    'company': 'C0001129853P',
    'lang': 'de_DE',
    'clientId': 'jobs2web',
    'socialApply': 'false',
    'career_ns': 'job_application',
    'site': '',
    'career_job_req_id': '26446',
    'jobPipeline': 'Direct',
    'isInternalUser': 'false'
}

with requests.Session() as s:
    s.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 6.1; ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36'
    r = s.post(first_post,data=payload)
    soup = BeautifulSoup(r.text,"lxml")

    login_post_url = login_url.format(soup.select_one('.bottomLink > a')['href'].split("s.crb=")[1])

    payload_ano = {i['name']:i.get('value','') for i in soup.select("input[name]")}
    payload_ano['username'] = 'simmthiqbal@gmail.com'
    payload_ano['password'] = 'SShift_12345'
    r = s.post(login_post_url,payload_ano)
    print(r.text)

当我运行上面的脚本时,我得到的文本来自上图所示的页面。

如何使用请求登录该站点?

评论