python - Python 中正确的三足 OAuth 工作流程是什么(例如:ImmoScout API)?(如何获取request_token)
问题描述
我正在尝试为 python 中的数据科学项目访问 ImmoScout24 web api,但我有点卡在 3 腿身份验证过程中。我用谷歌搜索了这个问题,但它有点特别,所以也许有人可以帮助我。
我想实现以下描述的工作流程:https ://api.immobilienscout24.de/api-docs/authentication/three-legged/#callback-url
为了获得 request_token(身份验证过程中的第一步),我尝试了以下方法:
API 凭证存储在这两个变量中:
client_key
client_secret
Python 代码如下所示
immoscout_api = OAuth1Session(client_key,
client_secret=client_secret)
request_token_url='http://rest.immobilienscout24.de/restapi/security/oauth/request_token'
fetch_response = immoscout_api.fetch_request_token(request_token_url)
我的 Jupyter Notebook 出现错误,如下所示:
TokenRequestDenied: Token request failed with code 403, response was '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>403 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
Bad request.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: M_HHRf9VaNN9xFRqWlHWt2txfuIsBE5fe6siJACFUFjVWw20p91jLg==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>'.
有人可以帮我获取请求令牌吗?
解决方案
推荐阅读
- python - 如何使用 pytest 测试迭代器函数?
- python - Python sqlite3 sqlite3.OperationalError:没有这样的列:网站即使存在列
- google-tag-manager - 您将如何识别您的某个网站的访问者是否与之前访问过您的另一个网站的同一个人(不同的域)?
- mysql - SQL 中的群组分析 - 当天的总回访用户,无论用户是否在前几天访问过
- javascript - 尝试使用 javascript 在 excel 插件中从 nrel 网站获取文件数据的问题
- redoc - 使用 Redoc 进行类似于 Rebelly API 的格式化
- spring - OpenApi (swagger) 使用 Spring 生成混合类型数据
- javascript - 将文件中的 JS 代码作为字符串传递给函数
- regex-lookarounds - 如何使用负后向排除分数?
- amazon-web-services - 没有可用的 CUDA GPU:Tacotron2 inferencing on cpu