Ejemplo n.º 1
0
 def method_add_torrent(self, torrent, download_to=None):
     torrent_dump = base64encode(torrent).decode('utf-8')
     return self.query(
         self.build_request_payload(
             'webapi.add_torrent', [torrent_dump, {'download_location': download_to}]
         )
     )
Ejemplo n.º 2
0
 def method_add_torrent(self, torrent, download_to=None):
     args = {
         'metainfo': base64encode(torrent),
     }
     if download_to is not None:
         args['download-dir'] = download_to
     return self.query(self.build_request_payload('torrent-add', args))  # torrent-added
Ejemplo n.º 3
0
 def method_add_torrent(self, torrent, download_to=None):
     args = {
         'metainfo': base64encode(torrent),
     }
     if download_to is not None:
         args['download-dir'] = download_to
     return self.query(self.build_request_payload('torrent-add',
                                                  args))  # torrent-added
Ejemplo n.º 4
0
 def method_add_torrent(self, torrent, download_to=None):
     torrent_dump = base64encode(torrent).decode('utf-8')
     return self.query(
         self.build_request_payload(
             'webapi.add_torrent',
             [torrent_dump, {
                 'download_location': download_to
             }]))
Ejemplo n.º 5
0
def test_base64encode_str():
    string_to_encode = 'this is string'
    encoded_bytes = utils.base64encode(string_to_encode)

    assert isinstance(encoded_bytes, bytes)
    assert encoded_bytes == b'dGhpcyBpcyBzdHJpbmc=\n'
Ejemplo n.º 6
0
def test_base64encode_bytes():
    bytes_to_encode = b'this is bytes to encode'
    encoded_bytes = utils.base64encode(bytes_to_encode)

    assert isinstance(encoded_bytes, bytes)
    assert encoded_bytes == b'dGhpcyBpcyBieXRlcyB0byBlbmNvZGU=\n'
Ejemplo n.º 7
0
def test_base64encode_str():
    string_to_encode = 'this is string'
    encoded_string = utils.base64encode(string_to_encode)

    assert isinstance(encoded_string, str)
    assert encoded_string == "dGhpcyBpcyBzdHJpbmc=\n"
Ejemplo n.º 8
0
def test_base64encode_bytes():
    bytes_to_encode = b'this is bytes to encode'
    encoded_string = utils.base64encode(bytes_to_encode)

    assert isinstance(encoded_string, str)
    assert encoded_string == 'dGhpcyBpcyBieXRlcyB0byBlbmNvZGU=\n'