processone / ejabberd

Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
https://www.process-one.net/en/ejabberd/
Other
6.09k stars 1.51k forks source link

Which python library should I use to create user JID, room and send message in ejabberd 2.1.11 #1355

Closed waghangad closed 7 years ago

waghangad commented 7 years ago

What version of ejabberd are you using?

ejabberd 2.1.11

What operating system (version) are you using?

ubuntu 14.04

How did you install ejabberd (source, package, distribution)?

apt-get -y install ejabberd

What did not work as expected? Are there error messages in the log? What

Not getting any library and code to connect xmpp server through python (frappe)

was the unexpected behavior? What was the expected result?

badlop commented 7 years ago

You can write a Jabber client for ejabberd using the same Python libraries than for any other Jabber server. So, simply search for "Python Jabber library", or "Python XMPP library", or similar

waghangad commented 7 years ago

I searched there are lot of libraries like aioxmpp, headstok,jabber.py, pyxmpp, pyxmpp2, sleekmpp, twisted words, xmpp-psn, xmpppy but no one given the actual code or API to connect to xmpp server the only library I got is pyejabberd with proper code and explaination.But in compatibility its shows that its not compatible for ejabberd 2.1.11 please help.

badlop commented 7 years ago

Ahh, you are asking a library to execute ejabberd commands. You can execute ejabberd commands using XMLRPC queries, simply enable ejabberd_xmlrpc, and use any python XMLRPC library. Example usage:

import xmlrpclib
server_url = 'http://127.0.0.1:4560'
server = xmlrpclib.ServerProxy(server_url)
EJABBERD_XMLRPC_LOGIN = {'user': 'user1', 'server': 'localhost', 'password': 'mypass11', 'admin': True}
def ejabberdctl1(command, data):
    fn = getattr(server, command)
    return fn(data)
def ejabberdctl2(command, data):
    fn = getattr(server, command)
    return fn(EJABBERD_XMLRPC_LOGIN, data)
print ""
result = ejabberdctl1('srg_get_info', {'group':'group1', 'host':'localhost'})
print result
waghangad commented 7 years ago

Traceback (most recent call last):

  File "F:\XMPP\WORKSPACE\FirstPython\example\Second.py", line 9, in <module>
    import xmlrpclib
  File "F:\abc\xmlrpclib-1.0.1\xmlrpclib.py", line 169
    MAXINT =  2L**31-1
               ^
SyntaxError: invalid syntax

Got this error

badlop commented 7 years ago

That's a problem related to that library. It works for me, but apparently it isn't recommended for newer Python versions: http://stackoverflow.com/questions/22538535/how-to-make-downloaded-python-libs-work-on-windows

waghangad commented 7 years ago

I successfully created and deleted user in ejabberd using above code but Im not able to create MUC room please help

iamscottweber commented 5 years ago

@waghangad Any update on this. I'm also having this issue.

licaon-kter commented 5 years ago

@iamscottweber OS? Ejabberd version? Logs?

mremond commented 5 years ago

Given how old the issue is, it is probably best to start with a new ticket describing the issue. It is very likely the problem will be different.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.