Get updates of completed torrents via SMS Part 2

The other day one of my friends Ankur , made a python script to get updates via sms using twitter account.
Check here :

I have changed the script to use Gmail SMTP instead .

import dbus,base64,urllib2,urllib
from dbus.mainloop.glib import DBusGMainLoop
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email import Encoders
import os

ver = "v1.0"
gmail_user = ""				                #Gmail Username

gmail_pwd  = ""					#Gmail Password
gmail_alias=" "+gmail_user                       #Gmail Nickname
gateway=""	# Check

def mailz(text):

    mail = MIMEMultipart()
    mail['From'] = gmail_alias

    mail['To'] = gateway
    mailServer = smtplib.SMTP("", 587)
    mailServer.login(gmail_user, gmail_pwd)
    mailServer.sendmail(gmail_user, gateway, mail.as_string())


s = dbus.SessionBus()
kt = s.get_object("org.ktorrent.ktorrent","/core")

def update(k):
        torrent = s.get_object("org.ktorrent.ktorrent","/torrent/"+k)
        name = torrent.get_dbus_method("name","org.ktorrent.torrent")
        mailz("ktorrent: finished " +name())


import gobject
loop = gobject.MainLoop()

One thought on “Get updates of completed torrents via SMS Part 2”

  1. hey … this is a very nice script…though i wanted to know how do you obtain the value of the connection parameter in the get_object() call … if i need to make a similar script for any desktop application then how do i obtain the connection name and also the parameters like /core that you’ve used…

Leave a Reply

Your email address will not be published. Required fields are marked *