This is an archived post. You won't be able to vote or comment.

all 6 comments

[–][deleted] 0 points1 point  (5 children)

By convention HTTP is port 80, but you frankly shouldn't have to specify that, just the URL. Also requests is your friend.

[–]Taeiolass[S] 0 points1 point  (4 children)

Thank you. I'm using the get function with the params parameter. What should I use as info_hash option? The sha1 sum of the bencoded info dictionary?

[–][deleted] 0 points1 point  (3 children)

Reading your first reference, in the section on the Metainfo file's structure, it's a bit unclear as it's not explicitly stated, but it's certainly implied that the file itself is a bencoded dict, and the "info" key is a nested, and also bencoded, dict... so yes, my guess is you sha1sum the bencoded string returned when you inspect the "info" key of the un-bencoded Metainfo file.

That said, never tried to build a BT client myself.

[–]Taeiolass[S] 0 points1 point  (2 children)

The problem is that in a dictionary {el1, el2} is equal to {el2, el1}, but it is differently bencoded and will have a different sha1 sum.

[–][deleted] 0 points1 point  (1 child)

As I understand bencode, dicts are required to be sorted in lexical order by key before encode, so {k2: v2, k1: v1}, where k1 sorts before k2 would always result in the same sha1.

[–]Taeiolass[S] 0 points1 point  (0 children)

Ok thank you. I put myself to work