我试图从我的跟踪器中获取一个torrent的对等列表,方法是将repsonse解析为一个announced请求。这就是我所做的:
import sys,binascii,urllib.parse,urllib.request
from bcode import bdecode
def announce(inputurl):
with urllib.request.urlopen(inputurl) as url:
print(url.read())
decoded = bdecode(url.read())
print(decoded)
infohash = sys.argv[1] # Read info hash from command line
encoded_infohash = urllib.parse.quote(binascii.a2b_hex(infohash)) # Encode inf_hash
announce_url = "http://my_tracker_ip:6969/announce?info_hash=" + encoded_infohash
announce(announce_url)
当我为一个示例torrent的info_散列运行它时,会产生以下错误:
^{pr2}$我不知道我哪里出错了。我使用的是python3.4.3
目前没有回答
相关问题 更多 >
编程相关推荐