Untitled
By: a guest | Mar 20th, 2010 | Syntax:
Python | Size: 1.61 KB | Hits: 106 | Expires: Never
import Skype4Py, datetime, re, httplib
from urllib import urlencode
skype = Skype4Py.Skype()
skype.Attach()
def message(msg, status):
print 'msg: '+ msg.Body+':'+status
print 'user: '+ msg.FromHandle
if status == 'SENDING' or status == 'READ':
if re.search('.date', msg.Body):
print '>> find date!'
today = datetime.date.today()
skype.SendMessage(msg.FromHandle, 'Today is '+str(today))
if re.search('.md5', msg.Body):
md5s = msg.Body.split('md5')
md5 = md5s[1].strip()
conn = httplib.HTTPConnection("www.md5.rednoize.com")
conn.request("GET", "?q="+ md5)
response = conn.getresponse()
data = response.read()
result = re.findall('<div id="result" >(.+?)</div>', data)
skype.SendMessage(msg.FromHandle, 'MD5: '+str(result[0]))
conn.close()
if re.search('.send', msg.Body):
send = msg.Body.strip('send')
number = send.split(' ')[0]
text = send.split(' ')[1]
sendname = 'Secret'
params = urlencode({'action': 'send','numTo': int(number), 'text': str(text), 'numFrom': str(sendname), 'numFromNr': str(number)})
headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
conns = httplib.HTTPConnection("smsbox.lv")
conns.request("POST", "/smsbox.sender.proces?action=send", params, headers)
skype.SendMessage(msg.FromHandle, 'Message Sent to '+int(number))
conns.close()
skype.OnMessageStatus = message
while(True): pass