python - 使用 Python request.get 参数,但它给了我错误的 url
问题描述
我正在尝试使用 Python 请求库从 Steam 中删除一些数据。但首先我需要修改我的网址
例如,如果我想访问带有标签的游戏
- 2D [id : 3871]
- 1980 年代 [编号:7743]
https://store.steampowered.com/search?tags=7743%2C3871
这是我需要的链接。但是当我这样做时
steam_url = "https://store.steampowered.com/search?"
search = request.get(steam_url, params = {'tags' : [7743, 3871]})
我得到这个网址
https://store.steampowered.com/search?tags=7743&tags=3871
仅向我展示 2D 游戏 [id : 3871]
为了解决这个问题,我试图这样做
steam_url = "https://store.steampowered.com/search?"
search = get(steam_url, params = {'tags' : '%2C'.join(list(map(str,[7743, 3871])))})
然后我得到这个网址
https://store.steampowered.com/search?tags=7743%252C3871
我不明白为什么这些 id 之间有%252C 。
我应该怎么办?
解决方案
我不明白为什么这些 id 之间有 %252C。
因为您正在使用which'%2C'.join
被转义为百分号。使用并让做转义。%252C
%25
','.join
requests.get
推荐阅读
- python - MacOS:ModuleNotFoundError:没有名为“object_detection”的模块
- identityserver4 - 注销重定向 Uri 在 Google 上的操作?
- tensorflow - CNN准确率没有提高
- c# - 当我想在设置一个 coockie 后重定向时,它说 HTTP 错误 401.0 - 未经授权
- javascript - RNLocation 包问题:subscribeToLocationUpdates 有时永远不会触发,有时它会自动开始工作
- python - 如何在音频时间序列图上方添加矩形和标签?
- android - 如何在 Android Kotlin 中使用 let 添加两个条件
- amazon-web-services - AWS 控制 IAM 用户支出
- ssl - 如何从 Netty SSLContext 中排除弱协议(密码套装)?
- r - 在 r 中找到每 6 小时的最大值变化