An XMPP library for use with Python 3.5+ asyncio.

horazont, updated 🕥 2023-02-19 13:33:31

aioxmpp

.. image:: https://travis-ci.org/horazont/aioxmpp.svg?branch=devel :target: https://travis-ci.org/horazont/aioxmpp

.. image:: https://coveralls.io/repos/github/horazont/aioxmpp/badge.svg?branch=devel :target: https://coveralls.io/github/horazont/aioxmpp?branch=devel

.. image:: https://img.shields.io/pypi/v/aioxmpp.svg :target: https://pypi.python.org/pypi/aioxmpp/

... is a pure-python XMPP library using the asyncio_ standard library module from Python 3.4 (and available as a third-party module to Python 3.3__).

.. _asyncio: https://docs.python.org/3/library/asyncio.html __ https://code.google.com/p/tulip/

.. remember to update the feature list in the docs

Features

  • Native Stream Management (XEP-0198) <https://xmpp.org/extensions/xep-0198.html>_ support for robustness against transient network failures (such as switching between wireless and wired networks).

  • Powerful declarative-style definition of XEP-based and custom protocols. Most of the time, you will not get in contact with raw XML or character data, even when implementing a new protocol.

  • Secure by default: TLS is required by default, as well as certificate validation. Certificate or public key pinning can be used, if needed.

  • Support for RFC 6121 (Instant Messaging and Presence) <https://tools.ietf.org/html/rfc6121> roster and presence management, along with XEP-0045 (Multi-User Chats) <https://xmpp.org/extensions/xep-0045.html> for your human-to-human needs.

  • Support for XEP-0060 (Publish-Subscribe) <https://xmpp.org/extensions/xep-0060.html> and XEP-0050 (Ad-Hoc Commands) <https://xmpp.org/extensions/xep-0050.html> for your machine-to-machine needs.

  • Several other XEPs, such as XEP-0115 <https://xmpp.org/extensions/xep-0115.html> (including native support for the reading and writing the capsdb <https://github.com/xnyhps/capsdb>) and XEP-0131 <https://xmpp.org/extensions/xep-0131.html>_.

  • APIs suitable for both one-shot scripts and long-running multi-account clients.

  • Well-tested and modular codebase: aioxmpp is developed in test-driven style and in addition to that, many modules are automatedly tested against Prosody <https://prosody.im/> and ejabberd <https://www.ejabberd.im/>, two popular XMPP servers.

There is more and there’s yet more to come! Check out the list of supported XEPs in the official documentation and open GitHub issues tagged as enhancement <https://github.com/horazont/aioxmpp/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement> for things which are planned and read on below on how to contribute.

Documentation

The aioxmpp API is thoroughly documented using Sphinx. Check out the official documentation for a quick start and the API reference_.

Dependencies

  • Python ≥ 3.4 (or Python = 3.3 with tulip and enum34)
  • DNSPython
  • lxml
  • sortedcollections__

__ https://pypi.python.org/pypi/sortedcollections

  • tzlocal__ (for i18n support)

__ https://pypi.python.org/pypi/tzlocal

  • pyOpenSSL__

__ https://pypi.python.org/pypi/pyOpenSSL

  • pyasn1_ and pyasn1_modules__

.. _pyasn1: https://pypi.python.org/pypi/pyasn1 __ https://pypi.python.org/pypi/pyasn1-modules

  • aiosasl__ (≥ 0.3 for ANONYMOUS support)

__ https://pypi.python.org/pypi/aiosasl

  • multidict__

__ https://pypi.python.org/pypi/multidict

  • aioopenssl__

__ https://github.com/horazont/aioopenssl

  • typing__ (Python < 3.5 only)

__ https://pypi.python.org/pypi/typing

Contributing

If you consider contributing to aioxmpp, you can do so, even without a GitHub account. There are several ways to get in touch with the aioxmpp developer(s):

  • The development mailing list <https://lists.zombofant.net/cgi-bin/mailman/listinfo/aioxmpp-devel>. Feel free to subscribe and post, but be polite and adhere to the Netiquette (RFC 1855) <https://tools.ietf.org/html/rfc1855>. Pull requests posted to the mailing list are also welcome!

  • The development MUC at [email protected]. Pull requests announced in the MUC are also welcome! Note that the MUC is set persistent, but nevertheless there may not always be people around. If in doubt, use the mailing list instead.

  • Open or comment on an issue or post a pull request on GitHub <https://github.com/horazont/aioxmpp/issues>_.

No idea what to do, but still want to get your hands dirty? Check out the list of 'help wanted' issues on GitHub <https://github.com/horazont/aioxmpp/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22>_ or ask in the MUC or on the mailing list. The issues tagged as 'help wanted' are usually of narrow scope, aimed at beginners.

Be sure to read the docs/CONTRIBUTING.rst for some hints on how to author your contribution.

Security issues

If you believe that a bug you found in aioxmpp has security implications, you are welcome to notify me privately. To do so, send a mail to Jonas Schäfer <mailto:[email protected]>_, encrypted using the GPG public key 0xE5EDE5AC679E300F (Fingerprint AA5A 78FF 508D 8CF4 F355 F682 E5ED E5AC 679E 300F).

If you prefer to disclose security issues immediately, you can do so at any of the places listed above.

More details can be found in the SECURITY.md <SECURITY.md>_ file.

Change log

The change log is included in the official documentation.

.. _change log: https://docs.zombofant.net/aioxmpp/devel/api/changelog.html .. _official documentation: https://docs.zombofant.net/aioxmpp/devel/ .. _quick start: https://docs.zombofant.net/aioxmpp/devel/user-guide/quickstart.html .. _API reference: https://docs.zombofant.net/aioxmpp/devel/api/index.html

Issues

Add Proxy Support

opened on 2023-02-20 09:47:51 by Luc1412

Currently I can't find any information about proxy support. It would be great if you could use a proxy.

A possible implementation could similar to aiohttp, where you can just pass a proxy string + possible a basic auth.

Initial DOAP file

opened on 2023-02-19 13:33:31 by Ppjet6

I copied the file over from slixmpp, changed a few things. Feel free to take over the branch and add/remove what you want :)

Tests fail on system with no timezone set

opened on 2022-01-12 05:31:07 by SamWhited

On an Arch Linux box with no timezone information set tests fail with the following:

``` warnings.warn("Can not find any timezone configuration, defaulting to UTC.") ........SSSSSSSS............................................................................SS...............................................................................S...........................SSSSSS................................................................................................................................................................................................................................................................................................................SSS...............................................................................................................................................................................................................................................................................................................................S....................................SSS...........................................................................................................SS.................................S...............................................................................................SSSSSSSSSSSSSSSSS.......................................................................................................................................................................................................................................................................................................................................................................................SSSSS......................SSSSS.................SS....................................SS.........SS.......................................................................................................................................................................................................................................................................................................................................................................................................................................................SSS..............S....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................SSSSSSS.................................................................................................E...................................................................................................................................................................................................................................................................................................................................................../usr/lib/python3.10/inspect.py:3056: RuntimeWarning: coroutine 'OrderedStateMachine.wait_for' was never awaited arg_val = next(arg_vals) RuntimeWarning: Enable tracemalloc to get the object allocation traceback .................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S............................................................................................................................................................................................................................................................................................................................................................................................................................................................ ====================================================================== ERROR: test_convert_field_datetime_default_locale (tests.test_i18n.TestLocalizingFormatter)


Traceback (most recent call last): File "/home/build/.cache/yay/python-aioxmpp/src/aioxmpp-0.13.1/tests/test_i18n.py", line 96, in test_convert_field_datetime_default_locale s = formatter.convert_field(dt, "s") File "/home/build/.cache/yay/python-aioxmpp/src/aioxmpp-0.13.1/aioxmpp/i18n.py", line 173, in convert_field tzinfo.normalize(value), AttributeError: 'datetime.timezone' object has no attribute 'normalize'


Ran 4540 tests in 68.844s

FAILED (SKIP=72, errors=1) sys:1: RuntimeWarning: coroutine 'CoroutineMock.call' was never awaited RuntimeWarning: Enable tracemalloc to get the object allocation traceback ```

Instead I would expect a default timezone and locale to be used.

Future finished exception=ConnectionError('stream shut down')

opened on 2021-08-20 09:36:09 by amjad-hub

I have installed openfire 4.2 and Miranda NG And now want to connect to Miranda account I got this error can you help please? where is the problem?

######### error message
raise NotImplementedError

NotImplementedError Future exception was never retrieved future: ConnectionError: stream shut down

################# this is my code

import asyncio import getpass

import aioxmpp import aioxmpp.xso as xso

async def main(local_jid, password): client = aioxmpp.PresenceManagedClient(local_jid,aioxmpp.make_security_layer(password))

async with client.connected():
    # msg = aioxmpp.Message(
    #             to = aioxmpp.JID.fromstr("[email protected]"),  # recipient_jid must be an aioxmpp.JID
    #             type_=aioxmpp.MessageType.CHAT )
    # # None is for "default language"
    # msg.body[None] = "Hello World!"
    print("Hello to xmpp")
    #await client.send(msg)
    await asyncio.sleep(30)

if name == "main":

# [email protected]
# euTheir3ur7vah4U

jid = aioxmpp.JID.fromstr('[email protected]')
password = 'euTheir3ur7vah4U' #'aZ6ga6ohcahl7tie' 'euTheir3ur7vah4U'
loop = asyncio.get_event_loop()
loop.run_until_complete(main(jid, password))
loop.close()

how to create `SASLProvider` for multiple token based sasl ?

opened on 2021-03-08 19:31:14 by Kavan72

like;- <auth mechanism="X-Auth" xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> <user_token>sometokenhere</user_token> <data_token>sometokenhere</data_token> </auth>

Is it possible to log stanzas?

opened on 2021-02-08 06:58:42 by kousu

When working in unfamiliar territory it is very helpful if I can see the XML passing between my program and server. Gajim has a great stanza debugger. slixmpp can print stanzas too. I can't figure out how to do the same with aioxmpp.

I looked in aioxmpp/xml.py and it doesn't seem like there are any log lines at all. Would it be possible to add them? Would that be the right place to add them?

Releases

2021-01-16 12:27:32

2019-07-08 16:03:10

2017-05-20 13:40:26

2016-10-08 15:49:58

The most important change in this release is the change of the license from GPLv3+ to LGPLv3+! (the same holds for aiosasl, which just had its v0.2.1 release).

The functional highlights of this release are base support for Data Forms and a first application of those in the Multi User Chats implementation. Aside from that, the examples have been refactored and rewritten. A Quickstart section was added to the documentation, hopefully helping people to get started with aioxmpp easier.

Bugfix release v0.6.1 2016-09-29 15:32:28

The bugfix release 0.6.1 fixes bugs in the aioxmpp.entitycaps, aioxmpp.roster and aioxmpp.presence services, rendering these services entirely unusable. The bugs were a regression introduced in 0.6.

Note to github users: This is also my first test with the github releases function.

Jonas Schäfer

If you like what I do and want to give back a little, get in touch. I always appreciate some awesome music, and I usually have a list of artists to choose from.

GitHub Repository Homepage

python asyncio xmpp xmpp-client-library xmpp-library