Question

ok I am well aware there are many other questions about this, but I have been searching and have yet to find a solid proper answer that doesnt revolve around jabber or something worse. (no offense to jabber users, just I don't want all the extras that come with it)

I currently have msnp and twisted.words, I simply want to send and receive messages, have read many examples that have failed to work, and msnp is poorly documented.

My preference is msnp as it requires much less code, I'm not looking for something complicated.

Using this code I can login, and view my friends that are online (can't send them messages though.):

import msnp
import time, threading



msn = msnp.Session()
msn.login('XXXXXXX@hotmail.com', 'XXXXXX')
msn.sync_friend_list()

class MSN_Thread(threading.Thread):
    def run(self):
        msn.start_chat("XXXXXXX@hotmail.com") #this does not work
        while True:
            msn.process()
            time.sleep(1)



start_msn = MSN_Thread()
start_msn.start()

I hope I have been clear enough, its pretty late and my head is not in a clear state after all this msn frustration.

edit: since it seems msnp is extremely outdated could anyone recommend with simple examples on how I could achieve this? Don't need anything fancy that requires other accounts.

Was it helpful?

Solution

There is also xmpp which is used for gmail.

OTHER TIPS

You are using a library abandoned in 2004 so i'm not sure if msnp could still be used to talk on MSN.
Anyway i would try with:

while True:
     msn.process(chats = True)
     time.sleep(1)

using the contact id and not the email address.

contacts = msn.friend_list.get_friends()
contact_id = contacts.get_passport_id() 

Your code just start the chat without sending anything; you need to add the code to send message.
Have a look to send_message method in this tutorial.

It looks like papyon is a maintained fork of the pymsn library, and is currently used by telepathy-butterfly and amsn2.

papyon is an MSN client library, that tries to abstract the MSN protocol gory details. It is a fork of the unmaintained pymsn MSN library. papyon uses the GLib main event loop to process the network events in an asynchronous manner.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top