gpt4 book ai didi

python-3.x - RoboBrowser BadRequestKeyError( key )

转载 作者:行者123 更新时间:2023-12-02 03:14:56 32 4
gpt4 key购买 nike

我正在尝试使用 RoboBrowser 登录网站,但遇到错误消息。

我的代码:

from robobrowser import RoboBrowser

browser = RoboBrowser()

def login():
browser.open('https://www.kijiji.ca/t-login.html')
form = browser.get_form(id="login-form")
form.fields["LoginEmailOrNickname"].value = "an_email_address"
form.fields["login-password"].value = "a_password"
form.fields["login-rememberMe"].value = "true"
browser.submit_form(form)

login()

错误信息:

  Traceback (most recent call last):
File "/home/rojaslee/Desktop/kijiji_poster/kijiji_poster.py", line 16, in <module>
login()
File "/home/rojaslee/Desktop/kijiji_poster/kijiji_poster.py", line 11, in login
form.fields["LoginEmailOrNickname"].value = ["an_email_address"]
File "/usr/local/lib/python3.4/dist-packages/werkzeug/datastructures.py", line 744, in __getitem__
raise exceptions.BadRequestKeyError(key)
werkzeug.exceptions.BadRequestKeyError: 400: Bad Request

最佳答案

旧线程,但我一直在为同样的问题而苦苦挣扎。这对我有用:

from robobrowser import Robobrowser

browser = RoboBrowser

def login():
browser.open('https://www.kijiji.ca/t-login.html')
form = browser.get_form(id="login-form")
form["EmailOrNickname"].value = "an_email_address"
form["password"].value = "a_password"
form["rememberMe"].value = "checked"
browser.submit_form(form)

关于python-3.x - RoboBrowser BadRequestKeyError( key ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37576190/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com