METADATA 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. Metadata-Version: 2.0
  2. Name: irc
  3. Version: 13.3.1
  4. Summary: IRC (Internet Relay Chat) protocol client library for Python
  5. Home-page: https://github.com/jaraco/irc
  6. Author: Jason R. Coombs
  7. Author-email: jaraco@jaraco.com
  8. License: UNKNOWN
  9. Platform: UNKNOWN
  10. Classifier: Development Status :: 5 - Production/Stable
  11. Classifier: Intended Audience :: Developers
  12. Classifier: License :: OSI Approved :: MIT License
  13. Classifier: Programming Language :: Python :: 2.7
  14. Classifier: Programming Language :: Python :: 3.3
  15. Classifier: Programming Language :: Python :: 3.4
  16. Classifier: Programming Language :: Python :: 3.5
  17. Requires-Dist: jaraco.collections
  18. Requires-Dist: jaraco.functools (>=1.5)
  19. Requires-Dist: jaraco.itertools
  20. Requires-Dist: jaraco.logging
  21. Requires-Dist: jaraco.text
  22. Requires-Dist: pytz
  23. Requires-Dist: six
  24. Internet Relay Chat (IRC) protocol client library
  25. -------------------------------------------------
  26. The home of irclib is:
  27. * https://github.com/jaraco/irc
  28. Documentation is available at:
  29. * https://pythonhosted.org/irc
  30. Change history is available at:
  31. * https://pythonhosted.org/irc/history.html
  32. You can `download project releases from PyPI
  33. <https://pypi.python.org/pypi/irc>`_.
  34. Tests are `continually run <https://travis-ci.org/#!/jaraco/irc>`_ using
  35. Travis-CI.
  36. |BuildStatus|_
  37. .. |BuildStatus| image:: https://secure.travis-ci.org/jaraco/irc.png
  38. .. _BuildStatus: https://travis-ci.org/jaraco/irc
  39. This library provides a low-level implementation of the IRC protocol for
  40. Python. It provides an event-driven IRC client framework. It has
  41. a fairly thorough support for the basic IRC protocol, CTCP, and DCC
  42. connections.
  43. In order to understand how to make an IRC client, it's best to read up first
  44. on the IRC specifications, available here:
  45. * http://www.irchelp.org/irchelp/rfc/
  46. Installation
  47. ============
  48. IRC requires Python versions specified in the `download pages
  49. <https://pypi.python.org/pypi/irc>`_ and definitely supports Python 3.
  50. You have several options to install the IRC project.
  51. * Use ``easy_install irc`` or ``pip install irc`` to grab the latest
  52. version from the cheeseshop (recommended).
  53. * Run ``python setup.py install`` (from the source distribution).
  54. Client Features
  55. ===============
  56. The main features of the IRC client framework are:
  57. * Abstraction of the IRC protocol.
  58. * Handles multiple simultaneous IRC server connections.
  59. * Handles server PONGing transparently.
  60. * Messages to the IRC server are done by calling methods on an IRC
  61. connection object.
  62. * Messages from an IRC server triggers events, which can be caught
  63. by event handlers.
  64. * Reading from and writing to IRC server sockets is normally done
  65. by an internal ``select()`` loop, but the ``select()`` may be done
  66. by an external main loop.
  67. * Functions can be registered to execute at specified times by the
  68. event-loop.
  69. * Decodes CTCP tagging correctly (hopefully); I haven't seen any
  70. other IRC client implementation that handles the CTCP
  71. specification subtilties.
  72. * A kind of simple, single-server, object-oriented IRC client class
  73. that dispatches events to instance methods is included.
  74. * DCC connection support.
  75. Current limitations:
  76. * The IRC protocol shines through the abstraction a bit too much.
  77. * Data is not written asynchronously to the server (and DCC peers),
  78. i.e. the ``write()`` may block if the TCP buffers are stuffed.
  79. * Like most projects, documentation is lacking ...
  80. Unfortunately, this library isn't as well-documented as I would like
  81. it to be. I think the best way to get started is to read and
  82. understand the example program ``irccat``, which is included in the
  83. distribution.
  84. The following files might be of interest:
  85. * ``irc/client.py``
  86. The library itself. Read the code along with comments and
  87. docstrings to get a grip of what it does. Use it at your own risk
  88. and read the source, Luke!
  89. * ``irc/bot.py``
  90. An IRC bot implementation.
  91. * ``irc/server.py``
  92. A basic IRC server implementation. Suitable for testing, but not
  93. production quality.
  94. Examples
  95. ========
  96. Example scripts in the scripts directory:
  97. * ``irccat``
  98. A simple example of how to use the IRC client. ``irccat`` reads
  99. text from stdin and writes it to a specified user or channel on
  100. an IRC server.
  101. * ``irccat2``
  102. The same as above, but using the ``SimpleIRCClient`` class.
  103. * ``servermap``
  104. Another simple example. ``servermap`` connects to an IRC server,
  105. finds out what other IRC servers there are in the net and prints
  106. a tree-like map of their interconnections.
  107. * ``testbot``
  108. An example bot that uses the ``SingleServerIRCBot`` class from
  109. ``irc.bot``. The bot enters a channel and listens for commands in
  110. private messages or channel traffic. It also accepts DCC
  111. invitations and echos back sent DCC chat messages.
  112. * ``dccreceive``
  113. Receives a file over DCC.
  114. * ``dccsend``
  115. Sends a file over DCC.
  116. NOTE: If you're running one of the examples on a unix command line, you need
  117. to escape the ``#`` symbol in the channel. For example, use ``\\#test`` or
  118. ``"#test"`` instead of ``#test``.
  119. Decoding Input
  120. ==============
  121. By default, the IRC library attempts to decode all incoming streams as
  122. UTF-8, even though the IRC spec stipulates that no specific encoding can be
  123. expected. Since assuming UTF-8 is not reasonable in the general case, the IRC
  124. library provides options to customize decoding of input by customizing the
  125. ``ServerConnection`` class. The ``buffer_class`` attribute on the
  126. ``ServerConnection`` determines which class is used for buffering lines from the
  127. input stream. By default it is ``buffer.DecodingLineBuffer``, but may be
  128. re-assigned with another class, following the interface of ``buffer.LineBuffer``.
  129. The ``buffer_class`` attribute may be assigned for all instances of
  130. ``ServerConnection`` by overriding the class attribute.
  131. For example:
  132. .. code:: python
  133. irc.client.ServerConnection.buffer_class = irc.buffer.LenientDecodingLineBuffer
  134. The ``LenientDecodingLineBuffer`` attempts UTF-8 but falls back to latin-1, which
  135. will avoid ``UnicodeDecodeError`` in all cases (but may produce unexpected
  136. behavior if an IRC user is using another encoding).
  137. The buffer may be overridden on a per-instance basis (as long as it's
  138. overridden before the connection is established):
  139. .. code:: python
  140. server = irc.client.IRC().server()
  141. server.buffer_class = irc.buffer.LenientDecodingLineBuffer
  142. server.connect()
  143. Alternatively, some clients may still want to decode the input using a
  144. different encoding. To decode all input as latin-1 (which decodes any input),
  145. use the following:
  146. .. code:: python
  147. irc.client.ServerConnection.buffer_class.encoding = 'latin-1'
  148. Or decode to UTF-8, but use a replacement character for unrecognized byte
  149. sequences:
  150. .. code:: python
  151. irc.client.ServerConnection.buffer_class.errors = 'replace'
  152. Or, to simply ignore all input that cannot be decoded:
  153. .. code:: python
  154. class IgnoreErrorsBuffer(irc.buffer.DecodingLineBuffer):
  155. def handle_exception(self):
  156. pass
  157. irc.client.ServerConnection.buffer_class = IgnoreErrorsBuffer
  158. On Python 2, it was possible to use the ``buffer.LineBuffer`` itself, which will
  159. pass the raw bytes. On Python 3, the library requires text for message
  160. processing, so a decoding buffer must be used. Therefore, use of the
  161. ``LineBuffer`` is considered deprecated and not supported on Python 3. Clients
  162. should use one of the above techniques for decoding input to text.
  163. Notes and Contact Info
  164. ======================
  165. Enjoy.
  166. Maintainer:
  167. Jason R. Coombs <jaraco@jaraco.com>
  168. Original Author:
  169. Joel Rosdahl <joel@rosdahl.net>
  170. Copyright © 1999-2002 Joel Rosdahl
  171. Copyright © 2011-2015 Jason R. Coombs
  172. Copyright © 2009 Ferry Boender