def client(): """qBittorrent Client for testing session""" try: client = Client(RAISE_NOTIMPLEMENTEDERROR_FOR_UNIMPLEMENTED_API_ENDPOINTS=True, VERBOSE_RESPONSE_LOGGING=True) client.auth_log_in() # add orig_torrent to qBittorrent client.torrents_add(urls=_orig_torrent_url, upload_limit=10, download_limit=10) return client except APIConnectionError: pytest.exit('qBittorrent was not running when tests started')
def client(): """qBittorrent Client for testing session""" try: client = Client( RAISE_NOTIMPLEMENTEDERROR_FOR_UNIMPLEMENTED_API_ENDPOINTS=True, VERBOSE_RESPONSE_LOGGING=True, VERIFY_WEBUI_CERTIFICATE=False, ) client.auth_log_in() # add orig_torrent to qBittorrent client.torrents_add(urls=_orig_torrent_url, upload_limit=10, download_limit=10) # enable RSS fetching client.app.preferences = dict(rss_processing_enabled=True) return client except APIConnectionError as e: pytest.exit("qBittorrent was not running when tests started: %s" % repr(e))
def download_torrent(magnet, target_path): from qbittorrentapi import Client client = Client(host=settings.TORRENT_SERVICE_URL, username='******', password='******') client.torrents_add(urls=[magnet], save_path=target_path)
#creating torrent from torrentool.api import Torrent import os from qbittorrentapi import Client import requests import subprocess import sys filename = input("please enter the file name to be seeded ") #filename="a1.mkv" #creating torrent for sharing os.system("py3createtorrent " + filename) #seeding and DHT formation client = Client(host="http://192.168.1.5:8080/", username='******', password='******') tor = client.torrents.info() #client.torrents_add(torrent_files = '/home/silver/Desktop/torflix/seed/a1.mkv.torrent') #Added the file file to the torrent list client.torrents_add(torrent_files=filename + '.torrent') print("successfully added the torrent and the magnet link for sharing is:") my_torrent = Torrent.from_file(filename + '.torrent') magb = my_torrent.magnet_link print(magb)