The seedbox.torrent.bencode Module¶
Encodes and Decodes messages (http://en.wikipedia.org/wiki/Bencode)
updated to support Python 3
-
exception
seedbox.torrent.bencode.BTFailure¶ Bases:
exceptions.ExceptionRepresents any torrent failure
-
class
seedbox.torrent.bencode.Bencached(s)¶ Bases:
objectCached bencode class
-
seedbox.torrent.bencode.bdecode(x)¶ Public method for decoding a message
Parameters: x – message to decode Returns: decoded message Return type: dict Raises BTFailure: decoding failure
-
seedbox.torrent.bencode.bencode(x)¶ Public method for encoding message
Parameters: x – message Returns: encoded string Return type: string
-
seedbox.torrent.bencode.bytes(s, *args, **kwargs)¶
-
seedbox.torrent.bencode.bytes_index(s, pattern, start)¶ Returns the index of pattern within string starting at position start.
Parameters: - s (str) – byte string to search for pattern
- pattern (str) – pattern to search for within byte string
- start (int) – position/index within byte string to start scanning
Returns: index of pattern within byte string
Return type: int
-
seedbox.torrent.bencode.chr_(s)¶ Integer to character to mapping.
Return the string representing a character whose Unicode code point is the integer i.
Parameters: s (int) – integer representation of unicode character Returns: string representation of unicode character Return type: str
-
seedbox.torrent.bencode.ord_(s)¶ Character to integer mapping.
Given a string representing one Unicode character, return an integer representing the Unicode code point of that character.
Parameters: s (str) – string representing single unicode character Returns: integer representation of unicode character Return type: int