使用 python 和请求远程登录到分离的网站

Remote login to decoupled website with python and requests

我正在尝试登录网站 www.seek.com.au。我正在尝试使用 Python 请求模块测试远程登录的可能性。该网站的前端是使用 React 设计的,因此我在 www.seek.com.au/sign-in

中看不到任何表单操作组件

当我运行以下代码时,我看到响应代码为200表示成功,但我怀疑它是否真的成功。主要问题是如果登录提交表单中没有操作元素,则使用哪个 URL。

import requests

payload = {'email': <username>, 'password': <password>}
url = 'https://www.seek.com.au'

with requests.Session() as s:
    response_op = s.post(url, data=payload)
    # print the response status code
    print(response_op.status_code)
    print(response_op.text)

当我检查输出数据 (response_op.text) 时,我在输出中看到单词 'Sign in' 和 'Register',这表明登录失败。如果成功,用户的名字将显示在该位置。我在这里做错了什么?

P.S:我不是要从该网站抓取数据,而是要登录到类似的网站。

试试这个代码:

import requests

payload={"email": "test@test.com", "password": "passwordtest", "rememberMe": True}
url = "https://www.seek.com.au:443/userapi/login"

with requests.Session() as s:
    response_op = s.post(url, json=payload)
    # print the response status code
    print(response_op.status_code)
    print(response_op.text)

您将请求发送到错误的 url。

希望对您有所帮助