示例#1
0
#leave empty list will disable this filter
strFilter = cfg['general']['filterList']

## get data from keyring to re-used
username = keyring.get_password('messagesReceiver', 'skypeUsername')
password = keyring.get_password('messagesReceiver', 'skypePassword')

prefix = "%s_" % username
token = keyring.get_password('messagesReceiver', prefix + 'skypeToken')
registrationToken = keyring.get_password('messagesReceiver', prefix + 'skypeRegistrationToken')

s = Skype(username, password, token, registrationToken)
if s.registrationToken == None:
    s.login()
    s.createRegistrationToken()
    s.subcribe()
    print("Getting endpoint and registrationToken...")


# trigger for Ctrl + C to quit
quit = False

def getSkype():
    print("Skype running...")
    while not quit:
        logTime = str(datetime.now())
        print(logTime + "pulling...")
        data = s.pull()
        print(logTime + "pulled")
        if data == "500" or data == "404":
            print(logTime + "Skype reset token, trying again...")
示例#2
0
from messenger import Skype
import keyring
import utils

token = keyring.get_password('messagesReceiver', 'skypeToken')
registrationToken = keyring.get_password('messagesReceiver', 'skypeRegistrationToken')
username = keyring.get_password('messagesReceiver', 'skypeUsername')
password = keyring.get_password('messagesReceiver', 'skypePassword')
s = Skype(token, registrationToken)
if s.token == None:
    s.login(username, password)
    print "logging in..."
if s.registrationToken == None:
    print s.createRegistrationToken()
    print s.subcribe()
    print "creating endpoint and registrationToken..."
while True:
    data = s.pull()
    if data == 404:
        print s.createRegistrationToken()
        print s.subcribe()
        data = s.pull()
    if data == 400:
        continue
    messages = utils.skypeParse(data)
    if not messages:
        continue
    for sender, receiver, message in messages:
        if receiver != None:
            print "%s to %s" % (sender, receiver)
        else: