有一个来自STEPN市场的产品解析器。要接收JSON响应,您需要在cookie中发送一个具有授权帐户的会话。
# how the parser works
cookies = {'SESSIONIDD2': '7951767220820838781:1658220355588:1400231'} # cookies received from the developer tools in the browser
r = request.get('https://api.stepn.com/run/orderlist?order=2001&chain=103&refresh=true&page=0&type=600&gType=&quality=&level=0&bread=0', cookies=cookies)
# get a JSON response with the necessary data
但是一段时间后,会话在cookie中注销,您需要再次登录浏览器并登录
我试图通过请求登录。会话(传递了所有报头和cookie),但在响应
中收到"用户名/密码不正确"。with requests.Session() as session:
r = session.get('https://m.stepn.com/')
r = session.get('https://api.stepn.com/run/login?account={email}&password={password}&type=3') # I also got the string for the request in the developer tools
# get {"code":201003,"msg":"Incorrect username/password"}
我最近撤销了Stepn web身份验证(电子邮件和密码加密)。以下是我在rust中的解决方案:https://github.com/Numenorean/stepn-password,您可以使用python(或C) ffi将其重制为库,然后从代码中调用所需的函数,因此之后您只需要发送正确的授权请求