Skip to content

Instantly share code, notes, and snippets.

@skvark
Created March 20, 2014 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skvark/595fd1e9b7a5b32f21b8 to your computer and use it in GitHub Desktop.
Save skvark/595fd1e9b7a5b32f21b8 to your computer and use it in GitHub Desktop.
Sends a message via XMPP. Set your own jid and password and the target jid. Takes in args from command line and sends them as a message. Install xmpppy: pip install xmpppy
import sys
import xmpp
your_jid = ""
password = ""
target_jid = ""
def main():
message = " ".join(sys.argv[1:])
message = message.strip()
jid = xmpp.protocol.JID(your_jid)
client = xmpp.Client(jid.getDomain(), debug=[])
client.connect()
client.auth(jid.getNode(), password)
client.sendInitPresence()
message = xmpp.Message(target_jid, message)
message.setAttr('type', 'chat')
client.send(message)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment