METADATA 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. Metadata-Version: 2.1
  2. Name: sleekxmpp
  3. Version: 1.3.2
  4. Summary: SleekXMPP is an elegant Python library for XMPP (aka Jabber, Google Talk, etc).
  5. Home-page: http://github.com/fritzy/SleekXMPP
  6. Author: Nathanael Fritz
  7. Author-email: fritzy@netflint.net
  8. License: MIT
  9. Platform: any
  10. Classifier: Intended Audience :: Developers
  11. Classifier: License :: OSI Approved :: MIT License
  12. Classifier: Programming Language :: Python
  13. Classifier: Programming Language :: Python :: 2.6
  14. Classifier: Programming Language :: Python :: 2.7
  15. Classifier: Programming Language :: Python :: 3.1
  16. Classifier: Programming Language :: Python :: 3.2
  17. Classifier: Programming Language :: Python :: 3.3
  18. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  19. Requires: dnspython
  20. Requires: pyasn1
  21. Requires: pyasn1_modules
  22. License-File: LICENSE
  23. SleekXMPP
  24. #########
  25. SleekXMPP is an MIT licensed XMPP library for Python 2.6/3.1+,
  26. and is featured in examples in
  27. `XMPP: The Definitive Guide <http://oreilly.com/catalog/9780596521271>`_
  28. by Kevin Smith, Remko Tronçon, and Peter Saint-Andre. If you've arrived
  29. here from reading the Definitive Guide, please see the notes on updating
  30. the examples to the latest version of SleekXMPP.
  31. SleekXMPP's design goals and philosphy are:
  32. **Low number of dependencies**
  33. Installing and using SleekXMPP should be as simple as possible, without
  34. having to deal with long dependency chains.
  35. As part of reducing the number of dependencies, some third party
  36. modules are included with SleekXMPP in the ``thirdparty`` directory.
  37. Imports from this module first try to import an existing installed
  38. version before loading the packaged version, when possible.
  39. **Every XEP as a plugin**
  40. Following Python's "batteries included" approach, the goal is to
  41. provide support for all currently active XEPs (final and draft). Since
  42. adding XEP support is done through easy to create plugins, the hope is
  43. to also provide a solid base for implementing and creating experimental
  44. XEPs.
  45. **Rewarding to work with**
  46. As much as possible, SleekXMPP should allow things to "just work" using
  47. sensible defaults and appropriate abstractions. XML can be ugly to work
  48. with, but it doesn't have to be that way.
  49. Get the Code
  50. ------------
  51. Get the latest stable version from PyPI::
  52. pip install sleekxmpp
  53. The latest source code for SleekXMPP may be found on `Github
  54. <http://github.com/fritzy/SleekXMPP>`_. Releases can be found in the
  55. ``master`` branch, while the latest development version is in the
  56. ``develop`` branch.
  57. **Latest Release**
  58. - `1.3.1 <http://github.com/fritzy/SleekXMPP/zipball/1.3.1>`_
  59. **Develop Releases**
  60. - `Latest Develop Version <http://github.com/fritzy/SleekXMPP/zipball/develop>`_
  61. Installing DNSPython
  62. --------------------
  63. If you are using Python3 and wish to use dnspython, you will have to checkout and
  64. install the ``python3`` branch::
  65. git clone http://github.com/rthalley/dnspython
  66. cd dnspython
  67. git checkout python3
  68. python3 setup.py install
  69. Discussion
  70. ----------
  71. A mailing list and XMPP chat room are available for discussing and getting
  72. help with SleekXMPP.
  73. **Mailing List**
  74. `SleekXMPP Discussion on Google Groups <http://groups.google.com/group/sleekxmpp-discussion>`_
  75. **Chat**
  76. `sleek@conference.jabber.org <xmpp:sleek@conference.jabber.org?join>`_
  77. Documentation and Testing
  78. -------------------------
  79. Documentation can be found both inline in the code, and as a Sphinx project in ``/docs``.
  80. To generate the Sphinx documentation, follow the commands below. The HTML output will
  81. be in ``docs/_build/html``::
  82. cd docs
  83. make html
  84. open _build/html/index.html
  85. To run the test suite for SleekXMPP::
  86. python testall.py
  87. The SleekXMPP Boilerplate
  88. -------------------------
  89. Projects using SleekXMPP tend to follow a basic pattern for setting up client/component
  90. connections and configuration. Here is the gist of the boilerplate needed for a SleekXMPP
  91. based project. See the documetation or examples directory for more detailed archetypes for
  92. SleekXMPP projects::
  93. import logging
  94. from sleekxmpp import ClientXMPP
  95. from sleekxmpp.exceptions import IqError, IqTimeout
  96. class EchoBot(ClientXMPP):
  97. def __init__(self, jid, password):
  98. ClientXMPP.__init__(self, jid, password)
  99. self.add_event_handler("session_start", self.session_start)
  100. self.add_event_handler("message", self.message)
  101. # If you wanted more functionality, here's how to register plugins:
  102. # self.register_plugin('xep_0030') # Service Discovery
  103. # self.register_plugin('xep_0199') # XMPP Ping
  104. # Here's how to access plugins once you've registered them:
  105. # self['xep_0030'].add_feature('echo_demo')
  106. # If you are working with an OpenFire server, you will
  107. # need to use a different SSL version:
  108. # import ssl
  109. # self.ssl_version = ssl.PROTOCOL_SSLv3
  110. def session_start(self, event):
  111. self.send_presence()
  112. self.get_roster()
  113. # Most get_*/set_* methods from plugins use Iq stanzas, which
  114. # can generate IqError and IqTimeout exceptions
  115. #
  116. # try:
  117. # self.get_roster()
  118. # except IqError as err:
  119. # logging.error('There was an error getting the roster')
  120. # logging.error(err.iq['error']['condition'])
  121. # self.disconnect()
  122. # except IqTimeout:
  123. # logging.error('Server is taking too long to respond')
  124. # self.disconnect()
  125. def message(self, msg):
  126. if msg['type'] in ('chat', 'normal'):
  127. msg.reply("Thanks for sending\n%(body)s" % msg).send()
  128. if __name__ == '__main__':
  129. # Ideally use optparse or argparse to get JID,
  130. # password, and log level.
  131. logging.basicConfig(level=logging.DEBUG,
  132. format='%(levelname)-8s %(message)s')
  133. xmpp = EchoBot('somejid@example.com', 'use_getpass')
  134. xmpp.connect()
  135. xmpp.process(block=True)
  136. Credits
  137. -------
  138. **Main Author:** Nathan Fritz
  139. `fritzy@netflint.net <xmpp:fritzy@netflint.net?message>`_,
  140. `@fritzy <http://twitter.com/fritzy>`_
  141. Nathan is also the author of XMPPHP and `Seesmic-AS3-XMPP
  142. <http://code.google.com/p/seesmic-as3-xmpp/>`_, and a former member of
  143. the XMPP Council.
  144. **Co-Author:** Lance Stout
  145. `lancestout@gmail.com <xmpp:lancestout@gmail.com?message>`_,
  146. `@lancestout <http://twitter.com/lancestout>`_
  147. **Contributors:**
  148. - Brian Beggs (`macdiesel <http://github.com/macdiesel>`_)
  149. - Dann Martens (`dannmartens <http://github.com/dannmartens>`_)
  150. - Florent Le Coz (`louiz <http://github.com/louiz>`_)
  151. - Kevin Smith (`Kev <http://github.com/Kev>`_, http://kismith.co.uk)
  152. - Remko Tronçon (`remko <http://github.com/remko>`_, http://el-tramo.be)
  153. - Te-jé Rogers (`te-je <http://github.com/te-je>`_)
  154. - Thom Nichols (`tomstrummer <http://github.com/tomstrummer>`_)