asp.net-web-api - uTorrent API 添加 url 给出 400 无效请求

标签 asp.net-web-api utorrent

为什么下面的代码给出 400 bad request。我们想要使用 utorrent 的 Web API 安排 torrent。

import urllib2, base64

username = "username"
password = "password"

request = urllib2.Request("http://<my_ip>:<torrent_webapi_port>/gui/?action=add-url&s=%s" % urllib2.quote("http://torcache.net/torrent/CDADFE86960C3255EB37B15F7E45C281F3A3C937.torrent?title=[kickass.to]arrow.s02e14.hdtv.x264.lol.ettv"))
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
print result.read()

最佳答案

请阅读以下 token 认证系统。

您应该在所有请求中发送一个名为“token=”的额外参数。 您可以从

获取token_value

http://:utorrent_web_api_port/gui/token.html

http://www.utorrent.com/community/developers/webapi#devs4

详细说明见以下链接。

https://github.com/bittorrent/webui/wiki/TokenSystem

关于asp.net-web-api - uTorrent API 添加 url 给出 400 无效请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22079581/

相关文章:

python - 比特流 udp 跟踪器响应

c# - 如何为 Web API Controller 编写单元测试

javascript - 如何处理到期日期的时差?

c# - Autofac单例和非单例在一起

c# - 当 Web API 是 MVC Web 应用程序的一部分时访问受限的 Web API Controller ?

bittorrent - 如何创建/构建/构建完全无跟踪器的 p2p(点对点)?

c# - ASP.NET Web-API OWIN : No HTTP resource was found that matches the request URI

utorrent 哈希 : element not found

python - 查找给定 torrent 文件的播种者/对等者 IP 地址的最佳方法是什么