Detailed Documentation
Login
- class seedrcc.login.Login(username=None, password=None)
Bases:
object
This class contains the methods to generate a login token
- Parameters:
username (str, optional) – Username of the account
password (str, optional) – Password of the account
Example
Logging with username and password
>>> seedr = Login('foo@foo.com', 'password')
Example
Authorizing with device code
>>> seedr = Login()
- getDeviceCode()
Generate a device and user code
Example
>>> response = seedr.getDeviceCode() >>> print(response)
- authorize(deviceCode=None)
Authorize and get a token for seedr account
- Parameters:
deviceCode (str, optional) – Device code from getDeviceCode() method
Example
Authorizing with username and password
>>> response = seedr.authorize() >>> print(response) >>> print(seedr.token)
Example
Authorizing with device code
>>> response = seedr.authorize(deviceCode) >>> print(response) >>> print(seedr.token)
Note
You must use the token from the instance variable ‘token’ instead of the ‘access_token’ or ‘refresh_token’ from the response.
Seedr
- class seedrcc.seedr.Seedr(token, callbackFunc=None)
Bases:
object
This class contains the method to access the seedr account
- Parameters:
token (str) – Token of the seedr account
callbackFunc (function, optional) – Callback function to call after the token is refreshed
Example
>>> seedr = Seedr(token='token')
Example
The callback function will be called after the token is refreshed.
>>> def callbackFunc(token): >>> print(f'Token refreshed: {token}')
>>> seedr = Seedr(token='token', callbackFunc=callbackFunc)
If the callback function has more than one argument, pass the function as a lambda function.
>>> def callbackFunc(token, userId): >>> print(f'Token refreshed of {userId}: {token}')
>>> seedr = Seedr(token='token', callbackFunc=lambda token: callbackFunc(token, '1234'))
- testToken()
Test the validity of the token
Example
>>> response = account.testToken() >>> print(response)
- refreshToken()
Refresh the expired token
Note
This method is called automatically after the token is refreshed by the module. However, you can call it manually if you want to refresh the token.
Example
>>> response = account.refreshToken() >>> print(account.token)
- getSettings()
Get the user settings
Example
>>> response = account.getSettings() >>> print(response)
- getMemoryBandwidth()
Get the memory and bandwidth usage
Example
>>> response = account.getMemoryBandwidth() >>> print(response)
- addTorrent(magnetLink=None, torrentFile=None, wishlistId=None, folderId='-1')
Add a torrent to the seedr account for downloading
- Parameters:
magnetLink (str, optional) – The magnet link of the torrent
torrentFile (str, optional) – Remote or local path of the torrent file
folderId (str, optional) – The folder id to add the torrent to. Defaults to ‘-1’.
Example
Adding torrent to the root folder using magnet link
>>> response = account.addTorrent(magnetLink='magnet:?xt=') >>> print(response)
Example
Adding torrent from local torrent file
>>> response = account.addTorrent(torrentFile='/path/to/torrent') >>> print(response)
Example
Adding torrent from remote torrent file
>>> response = account.addTorrent(torrentFile='https://api.telegram.org/file/bot<token>/<file_path>') >>> print(response)
Example
Adding torrent using wishlistId
>>> response = account.addTorrent(wishlistId='12345') >>> print(response)
Example
Adding torrent to a certain folder
>>> response = account.addTorrent(magnetLink='magnet', folderId='12345') >>> print(response)
- scanPage(url)
Scan a page and return a list of torrents. For example, you can pass the torrent link of 1337x.to and it will fetch the magnet link from that page.
- Parameters:
url (str) – The url of the page to scan
Example
>>> response = account.scanPage(url='https://1337x.to/torrent/1010994') >>> print(response)
- createArchive(folderId)
Create an archive link of a folder
- Parameters:
folderId (str) – The folder id to create the archive of
Example
>>> response = account.createArchive(folderId='12345') >>> print(response)
- fetchFile(fileId)
Create a link of a file
- Parameters:
fileId (string) – The file id to fetch
Example
>>> response = account.fetchFile(fileId='12345') >>> print(response)
- listContents(folderId=0, contentType='folder')
List the contents of a folder
- Parameters:
folderId (str, optional) – The folder id to list the contents of. Defaults to root folder.
contentType (str, optional) – The type of content to list. Defaults to ‘folder’.
Example
list the contents of the root folder
>>> response = account.listContents() >>> print(response)
Example
list the contents of the folder with id ‘12345’
>>> response = account.listContents(folderId='12345') >>> print(response)
- renameFile(fileId, renameTo)
Rename a file
- Parameters:
fileId (str) – The file id to rename
renameTo (str) – The new name of the file
Example
>>> response = account.renameFile(fileId='12345', renameTo='newName') >>> print(response)
- renameFolder(folderId, renameTo)
Rename a folder
- Parameters:
folderId (str) – The folder id to rename
renameTo (str) – The new name of the folder
Example
>>> response = account.renameFolder(folderId='12345', renameTo='newName') >>> print(response)
- deleteFile(fileId)
Delete a file
- Parameters:
fileId (str) – The file id to delete
Example
>>> response = account.deleteFile(fileId='12345') >>> print(response)
- deleteFolder(folderId)
Delete a folder
- Parameters:
folderId (str) – The folder id to delete
Example
>>> response = account.deleteFolder(folderId='12345') >>> print(response)
- deleteWishlist(wishlistId)
Delete an item from the wishlist
- Parameters:
wishlistId (str) – The wishlistId of item to delete
Example
>>> response = account.deleteWishlist(wishlistId='12345') >>> print(response)
- deleteTorrent(torrentId)
Delete an active downloading torrent
- Parameters:
torrentId (str) – The torrent id to delete
Example
>>> response = account.deleteTorrent(torrentId='12345') >>> print(response)
- addFolder(name)
Add a folder
- Parameters:
name (str) – Folder name to add
Example
>>> response = account.addFolder(name='New Folder') >>> print(response)
- searchFiles(query)
Search for files
- Parameters:
query (str) – The query to search for
Example
>>> response = account.searchFiles(query='harry potter') >>> print(response)
- changeName(name, password)
Change the name of the account
- Parameters:
name (str) – The new name of the account
password (str) – The password of the account
Example
>>> response = account.changeName(name='New Name', password='password') >>> print(response)
- changePassword(oldPassword, newPassword)
Change the password of the account
- Parameters:
oldPassword (str) – The old password of the account
newPassword (str) – The new password of the account
Example
>>> response = account.changePassword(oldPassword='oldPassword', newPassword='newPassword') >>> print(response)
- getDevices()
Get the devices connected to the seedr account
Example
>>> response = account.getDevices() >>> print(response)