예제 #1
0
파일: deluge.py 프로젝트: idlesign/torrt
 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}]
         )
     )
예제 #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
예제 #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
예제 #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
             }]))
예제 #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'
예제 #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'
예제 #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"
예제 #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'