diff --git a/src/aria2p/api.py b/src/aria2p/api.py index f599eb7..538d5cc 100644 --- a/src/aria2p/api.py +++ b/src/aria2p/api.py @@ -48,9 +48,9 @@ def add_torrent(self, torrent_file_path, uris=None, options=None, position=None) else: client_options = options - with open(torrent_file_path) as stream: + with open(torrent_file_path, "rb") as stream: torrent_contents = stream.read() - encoded_contents = b64encode(torrent_contents) + encoded_contents = b64encode(torrent_contents).decode("utf8") gid = self.client.add_torrent(encoded_contents, uris, client_options, position)