Module Expr Str Assign NameStore Str Import alias ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr Str FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Num For TupleStore NameStore NameStore Call NameLoad NameLoad body If Call NameLoad NameLoad NameLoad body Assign NameStore NameLoad Break If NameLoad body Assign SubscriptStore NameLoad Slice BinOpAdd NameLoad Num BinOpAdd ListLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Slice NameLoad decorator_list ClassDef bases NameLoad NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr IfExp NameLoad NameLoad Call NameLoad Expr Call AttributeLoad NameLoad attr NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AugAssignAdd AttributeStore NameLoad attr ListLoad AttributeLoad NameLoad attr AugAssignAdd AttributeStore NameLoad attr BinOpAdd BinOpAdd Call NameLoad NameLoad AttributeLoad NameLoad attr ListLoad NameLoad Expr Call NameLoad AttributeLoad NameLoad attr If CompareIsNot NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad For NameStore AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse Assign AttributeStore NameLoad attr Call NameLoad NameLoad AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body For NameStore AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign AttributeStore NameLoad attr ListLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str With AttributeLoad NameLoad attr body If CompareIsNot AttributeLoad NameLoad attr NameLoad body Return AttributeLoad AttributeLoad NameLoad attr attr orelse Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str With AttributeLoad NameLoad attr body If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Str If NameLoad body Assign NameStore NameLoad orelse Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Str Expr Call AttributeLoad NameLoad attr NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Str NameLoad Assign NameStore AttributeLoad NameLoad attr AugAssignAdd NameStore BinOpAdd AttributeLoad NameLoad attr ListLoad NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr NameLoad NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad AugAssignAdd AttributeStore NameLoad attr ListLoad NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str With AttributeLoad NameLoad attr body If AttributeLoad NameLoad attr body If SubscriptLoad AttributeLoad NameLoad attr Index Str body Expr Call AttributeLoad NameLoad attr Call NameLoad keyword Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str With AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr If CompareIn AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str With AttributeLoad NameLoad attr body If CompareNotEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return Assign AttributeStore NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore AttributeLoad NameLoad attr AugAssignAdd NameStore BinOpAdd AttributeLoad NameLoad attr ListLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Str decorator_list Call NameLoad NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str With AttributeLoad NameLoad attr body If CompareNotEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return Assign AttributeStore NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Str If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list Call NameLoad NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str With AttributeLoad NameLoad attr body If CompareNotEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return If BoolOpAnd CompareIsNot AttributeLoad NameLoad attr NameLoad CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body If CompareIn AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list Call NameLoad NameLoad FunctionDef arguments args NameParam defaults body Expr Str With AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If CompareIs NameLoad NameLoad body Return Num orelse Return Call NameLoad Num NameLoad decorator_list Call NameLoad Num FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr Return ListLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call NameLoad AttributeLoad NameLoad attr decorator_list decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call NameLoad decorator_list Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Num keyword NameLoad keyword NameLoad keyword Call AttributeLoad NameLoad attr Num Num keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword NameLoad keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword NameLoad keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Num keyword AttributeLoad NameLoad attr keyword Str keyword Str
N/A N/A Basic XMPP-IM client implementation.

The `Client` class provides the base for client applications.

To create an XMPP client session applications should create a `Client` instance 
providing in the constructor: a client JID, settings and handlers providing
application behaviour (the list may contain a single handler object which will
be 'the application). The `Client` class will provide some other handlers:
`StreamTLSHandler`, `StreamSASLHandler`, `SessionHandler`,
`ResourceBindingHandler` and `RosterClient`. The last one is available via the
`Client.roster_client` attribute and should be used to manipulate the roster.
The roster itself is available via the `Client.roster` property.

The `Client` object will open an XMPP stream after the `Client.connect` method
is called. It will send the initial presence (specified by 
the :r:`initial_presence setting` ) upon log-in and the final presence on
log-out.  Other presence handling, including subscriptions is the
responsibility of the application.

The API is asynchronous and actual connection is made and data exchanged in the
main event loop. A `MainLoop` object can be passed to the `Client` constructor,
but this is not needed, as `Client` will create one if needed. The main loop
can be started by `Client.run()`.

To close the XMPP session use the `Client.disconnect()` method.

Normative reference:
  - :RFC:`6120`
  - :RFC:`6121`
 N/A __docformat__ restructuredtext en N/A logging clientstream ClientStream mainloop main_loop_factory interfaces EventHandler event_handler interfaces TimeoutHandler timeout_handler streamevents DisconnectedEvent AuthenticatedEvent streamevents AuthorizedEvent transport TCPTransport settings XMPPSettings session SessionHandler streamtls StreamTLSHandler streamsasl StreamSASLHandler binding ResourceBindingHandler stanzaprocessor StanzaProcessor roster RosterClient presence Presence N/A logger N/A N/A logging getLogger pyxmpp2.client _move_session_handler N/A N/A handlers N/A N/A N/A Find a SessionHandler instance in the list and move it to the beginning.
     N/A index 0 N/A N/A i handler N/A enumerate handlers N/A N/A N/A isinstance handler SessionHandler N/A N/A index i N/A N/A index N/A N/A N/A handlers N/A N/A index 1 N/A N/A N/A handlers N/A index N/A handlers N/A index N/A Client N/A StanzaProcessor TimeoutHandler EventHandler N/A N/A Base class for an XMPP-IM client.

    Joins the `MainLoop`, `ClientStream` and some basic handlers together,
    so a client application needs only to add its handlers.

    :Ivariables:
        - `jid`: configured JID of the client (current full JID is avialable as
          ``self.stream.jid``).
        - `main_loop`: the main loop object
        - `settings`: configuration settings
        - `handlers`: stream and main loop handlers provided via the
          constructor
        - `stream`: the stream object when connected
        - `roster_client`: the roster interface object
        - `_ml_handlers`: list of handlers installed by this object to at the
          main loop
    :Types:
        - `jid`: `jid.JID`
        - `main_loop`: `main_loop.interfaces.MainLoop`
        - `settings`: `XMPPSettings`
        - `stream`: `clientstream.ClientStream`
        - `roster_client`: `RosterClient`
     __init__ N/A N/A self jid handlers settings main_loop N/A None None N/A N/A Initialize a Client object.

        :Parameters:
            - `jid`: user JID for the connection.
            - `settings`: client settings.
            - `main_loop`: Main event loop to attach to. If None, a loop
              will be created.
        :Types:
            - `jid`: `jid.JID`
            - `settings`: `settings.XMPPSettings`
            - `main_loop`: `main_loop.interfaces.MainLoop`
         N/A N/A self _ml_handlers N/A N/A N/A self jid jid N/A N/A self settings N/A settings settings N/A XMPPSettings N/A N/A N/A StanzaProcessor __init__ self N/A N/A self settings N/A default_stanza_timeout N/A N/A self handlers handlers N/A N/A self _base_handlers N/A N/A self base_handlers_factory N/A N/A self roster_client N/A N/A self roster_client_factory N/A N/A self _base_handlers N/A N/A self roster_client N/A N/A self _ml_handlers N/A N/A N/A list handlers N/A self _base_handlers N/A self N/A N/A _move_session_handler N/A self _ml_handlers N/A N/A main_loop None N/A N/A N/A self main_loop main_loop N/A handler N/A self _ml_handlers N/A N/A N/A N/A N/A self main_loop add_handler handler N/A N/A N/A self main_loop N/A main_loop_factory settings N/A self _ml_handlers N/A N/A self stream None N/A __del__ N/A N/A self N/A N/A N/A handler N/A self _ml_handlers N/A N/A N/A N/A N/A self main_loop remove_handler handler N/A N/A self _ml_handlers N/A N/A roster N/A N/A self N/A N/A N/A Current roster.

        Shortcut for ``self.roster_client.roster``.
         N/A N/A self lock N/A N/A N/A N/A self roster_client None N/A N/A N/A N/A self roster_client roster N/A N/A None N/A property connect N/A N/A self N/A N/A N/A Schedule a new XMPP c2s connection.
         N/A N/A self lock N/A N/A N/A self stream N/A N/A N/A N/A logger debug Closing the previously used stream. N/A N/A N/A self _close_stream N/A transport N/A TCPTransport N/A self settings N/A addr N/A N/A self settings N/A server N/A addr N/A N/A service None N/A N/A addr N/A N/A self jid domain N/A service N/A N/A self settings N/A c2s_service N/A N/A N/A transport connect addr N/A N/A self settings N/A c2s_port service N/A handlers N/A self _base_handlers N/A handlers N/A N/A self handlers N/A self N/A N/A N/A self clear_response_handlers N/A N/A N/A self setup_stanza_handlers handlers pre-auth N/A stream N/A ClientStream N/A self jid self handlers N/A self settings N/A N/A N/A stream initiate transport N/A N/A N/A N/A self main_loop add_handler transport N/A N/A N/A N/A self main_loop add_handler stream N/A N/A self _ml_handlers N/A transport stream N/A N/A self stream stream N/A N/A self uplink stream N/A disconnect N/A N/A self N/A N/A N/A Gracefully disconnect from the server. N/A N/A self lock N/A N/A N/A self stream N/A N/A N/A N/A self settings N/A initial_presence N/A N/A N/A N/A self send N/A Presence stanza_type unavailable N/A N/A N/A N/A self stream disconnect N/A close_stream N/A N/A self N/A N/A N/A Close the stream immediately.
         N/A N/A self lock N/A N/A N/A N/A self _close_stream N/A _close_stream N/A N/A self N/A N/A N/A Same as `close_stream` but with the `lock` acquired.
         N/A N/A N/A N/A self stream close N/A N/A N/A N/A self stream transport N/A self _ml_handlers N/A N/A N/A N/A N/A self _ml_handlers remove N/A N/A self stream transport N/A N/A N/A N/A self main_loop remove_handler N/A N/A self stream transport N/A N/A self stream None N/A N/A self uplink None N/A run N/A N/A self timeout N/A None N/A N/A Call the main loop.

        Convenience wrapper for ``self.main_loop.loop``
         N/A N/A N/A N/A self main_loop loop timeout N/A _stream_authenticated N/A N/A self event N/A N/A N/A Handle the `AuthenticatedEvent`.
         N/A N/A self lock N/A N/A N/A N/A event stream N/A self stream N/A N/A N/A N/A self me N/A N/A event stream me N/A N/A self peer N/A N/A event stream peer N/A handlers N/A self _base_handlers N/A handlers N/A N/A self handlers N/A self N/A N/A N/A self setup_stanza_handlers handlers post-auth N/A N/A event_handler AuthenticatedEvent _stream_authorized N/A N/A self event N/A N/A N/A Handle the `AuthorizedEvent`.
         N/A N/A self lock N/A N/A N/A N/A event stream N/A self stream N/A N/A N/A N/A self me N/A N/A event stream me N/A N/A self peer N/A N/A event stream peer N/A presence N/A N/A self settings N/A initial_presence N/A presence N/A N/A N/A N/A self send presence N/A N/A event_handler AuthorizedEvent _stream_disconnected N/A N/A self event N/A N/A N/A Handle stream disconnection event.
         N/A N/A self lock N/A N/A N/A N/A event stream N/A self stream N/A N/A N/A N/A N/A N/A self stream None N/A N/A event stream N/A self stream N/A N/A N/A N/A N/A self stream transport N/A self _ml_handlers N/A N/A N/A N/A N/A self _ml_handlers remove N/A N/A self stream transport N/A N/A N/A N/A self main_loop remove_handler N/A N/A self stream transport N/A N/A self stream None N/A N/A self uplink None N/A N/A event_handler DisconnectedEvent regular_tasks N/A N/A self N/A N/A N/A Do some housekeeping (cache expiration, timeout handling).

        This method should be called periodically from the application's
        main loop.
        
        :Return: suggested delay (in seconds) before the next call to this
                                                                    method.
        :Returntype: `int`
         N/A N/A self lock N/A N/A ret N/A N/A N/A self _iq_response_handlers expire N/A N/A ret None N/A N/A 1 N/A N/A N/A min 1 ret N/A N/A timeout_handler 1 base_handlers_factory N/A N/A self N/A N/A N/A Default base client handlers factory.

        Subclasses can provide different behaviour by overriding this.

        :Return: list of handlers
         N/A tls_handler N/A StreamTLSHandler N/A self settings N/A sasl_handler N/A StreamSASLHandler N/A self settings N/A session_handler N/A SessionHandler N/A binding_handler N/A ResourceBindingHandler N/A self settings N/A N/A tls_handler sasl_handler binding_handler session_handler N/A roster_client_factory N/A N/A self N/A N/A N/A Creates the `RosterClient` instance for the `roster_client`
        attribute.
        
        Subclasses can provide different behaviour by overriding this. The
        overriding method can return `None` if no roster client is needed.

        :Return: `RosterClient`
         N/A N/A RosterClient N/A self settings N/A N/A _initial_presence_factory N/A N/A settings N/A N/A N/A Factory for the :r:`initial_presence setting` default.
     N/A N/A Presence N/A N/A N/A N/A XMPPSettings add_setting initial_presence factory _initial_presence_factory default_d Just ``Presence()`` doc Default initial presence stanza, to be send on login.
Set to ``None`` not to send the initial presence. N/A N/A N/A XMPPSettings add_setting c2s_port default 5222 basic True type int validator N/A N/A XMPPSettings get_int_range_validator 1 65536 cmdline_help Port number for XMPP client connections doc Port number for client to server connections. N/A N/A N/A XMPPSettings add_setting c2s_service default xmpp-client type str cmdline_help SRV service name XMPP client connections doc SRV service name for client to server connections. N/A N/A N/A XMPPSettings add_setting server type str basic True cmdline_help Server address. (Default: use SRV lookup) doc Server address to connect to. By default a DNS SRV record look-up
is done for the requested JID domain part and if that fails - 'A' or 'AAAA'
record lookup for the same domain. This setting may be used to force using
a specific server or when SRV look-ups are not available. N/A N/A N/A XMPPSettings add_setting default_stanza_timeout type float default 300 validator N/A XMPPSettings validate_positive_float cmdline_help Time in seconds to wait for a stanza response doc Time in seconds to wait for a stanza response.