登录此网站时遇到问题:https://illinoisjoblink.illinois.gov/ada/r/home
我可以提交有效负载,但是我被重定向到声称书签错误的页面。这是代码和相关的错误消息。我不知道该怎么办。我感谢任何和所有的帮助。谢谢!
session = requests.Session()
soup = BeautifulSoup(session.get(SEARCH_URL).content, "html.parser")
inputs = soup.find_all('input')
token = ''
for t in inputs:
try:
if t['name'] == 'authenticity_token':
token = t['value']
break
except KeyError as e:
pass
login_data = dict(v_username=USER_NAME,
v_password=PASSWORD,
authenticity_token=token,
commit='Log In')
login_data['utf-8'] = '✓'
r = session.post(LOGIN_URL, data=login_data)
print(r.content)
Bookmark Error <b>You may be seeing this error as a result of bookmarking this page. Unfortunately, our site design will not allow the bookmarking of most internal pages.</b> If you wish to contact the system administra
tor concerning this error, you may send an email to <a href="mailto:DES.IJLSysAdmSpprt@illinois.gov">DES.IJLSysAdmSpprt@illinois.gov</a>. Please reference error number <b>646389</b>.<p>Thank you for your patience.<br><br> Hit your browser back button to return to the previous page.
答案 0 :(得分:0)
也许你的login_data
参数错了?当我检查POST以进行登录时,必要的参数显示为:v_username
,v_password
,FormName
,fromlogin
,也许最重要的是,button
。我建议你将所有这些参数添加到login_data
字典中。你的字典看起来像:
login_data = {'v_username': USER_NAME,
'v_password': PASSWORD,
'authenticity_token': token,
'FormName': 0,
'fromlogin': 1,
'button': 'Log+in'}