AMPS Python Client API Reference
================================

Introduction
------------

The AMPS Python client is the official library for working with AMPS from Python applications. It provides a straightforward
way to establish connections, publish data, execute commands, and process message streams.

Designed to align with Python development practices, the client offers a clear and consistent interface while exposing the
underlying capabilities of AMPS. This makes it suitable for both simple integrations and more advanced messaging workflows.

Basic Example
^^^^^^^^^^^^^

The example below shows a minimal publish flow using the Python client:

.. code-block:: python

   import AMPS
   import sys

   uri = "tcp://localhost:9007/amps/json"

   client = AMPS.Client("publish-example")

   try:
       client.connect(uri)
       client.logon()
       client.publish("messages", '{"hi" : "Hello, world!"}')

   except AMPS.AMPSException as e:
       sys.stderr.write(str(e))

   client.publish_flush()

For details on how to start using the AMPS client and additional examples, see the
`Quickstart page <https://crankuptheamps.com/clients/amps-client-python/quickstart>`_ in the
AMPS Python Client Developer Guide.

Core Types
----------

.. autoclass:: AMPS.Client
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.HAClient
   :members:
   :inherited-members:
   :exclude-members: Bookmarks, ConnectionStateListener
   :member-order: groupwise

.. autoclass:: AMPS.Command
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.Message
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.MessageStream
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.VersionInfo
   :members:
   :member-order: groupwise

Connection And Runtime Helpers
------------------------------

.. autoclass:: AMPS.DefaultAuthenticator
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.DefaultServerChooser
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.ExponentialDelayStrategy
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.FixedDelayStrategy
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.Reason
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.CMessageHandler
   :members:
   :member-order: groupwise

Stores And Recovery
-------------------

.. autoclass:: AMPS.Store
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.PublishStore
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.MemoryPublishStore
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.HybridPublishStore
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.MemoryBookmarkStore
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.MMapBookmarkStore
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.RingBookmarkStore
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.RecoveryPoint
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.ConflatingRecoveryPointAdapter
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.SOWRecoveryPointAdapter
   :members:
   :member-order: groupwise

Builders And Parsers
--------------------

.. autoclass:: AMPS.FIXBuilder
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.FIXShredder
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.NVFIXBuilder
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.NVFIXShredder
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.CompositeMessageBuilder
   :members:
   :member-order: groupwise

.. autoclass:: AMPS.CompositeMessageParser
   :members:
   :member-order: groupwise

Module Functions And Data
-------------------------

.. autofunction:: AMPS.ssl_get_context

.. autofunction:: AMPS.ssl_init

.. autofunction:: AMPS.ssl_load_verify_locations

.. autofunction:: AMPS.ssl_set_verify

.. autodata:: AMPS.VERSION

Exception Classes
-----------------

.. autoexception:: AMPS.AMPSException

.. autoexception:: AMPS.AlreadyConnected

.. autoexception:: AMPS.AlreadyConnectedException

.. autoexception:: AMPS.AuthenticationError

.. autoexception:: AMPS.AuthenticationException

.. autoexception:: AMPS.BadFilter

.. autoexception:: AMPS.BadFilterException

.. autoexception:: AMPS.BadRegexTopic

.. autoexception:: AMPS.BadRegexTopicException

.. autoexception:: AMPS.BadSowKeyException

.. autoexception:: AMPS.ClientNameInUse

.. autoexception:: AMPS.CommandError

.. autoexception:: AMPS.CommandException

.. autoexception:: AMPS.CommandTimedOut

.. autoexception:: AMPS.CommandTypeError

.. autoexception:: AMPS.ConnectionError

.. autoexception:: AMPS.ConnectionException

.. autoexception:: AMPS.ConnectionRefused

.. autoexception:: AMPS.ConnectionRefusedException

.. autoexception:: AMPS.CorruptedRecord

.. autoexception:: AMPS.Disconnected

.. autoexception:: AMPS.DisconnectedException

.. autoexception:: AMPS.DuplicateLogonException

.. autoexception:: AMPS.InvalidBookmarkException

.. autoexception:: AMPS.InvalidMessageTypeOptions

.. autoexception:: AMPS.InvalidOptionsException

.. autoexception:: AMPS.InvalidOrderByException

.. autoexception:: AMPS.InvalidSubIdException

.. autoexception:: AMPS.InvalidTopicError

.. autoexception:: AMPS.InvalidTopicException

.. autoexception:: AMPS.InvalidTransportOptions

.. autoexception:: AMPS.InvalidTransportOptionsException

.. autoexception:: AMPS.InvalidUriException

.. autoexception:: AMPS.InvalidUriFormat

.. autoexception:: AMPS.LocalStorageError

.. autoexception:: AMPS.LogonRequiredException

.. autoexception:: AMPS.MessageTypeError

.. autoexception:: AMPS.MessageTypeException

.. autoexception:: AMPS.MessageTypeNotFound

.. autoexception:: AMPS.MissingFieldsException

.. autoexception:: AMPS.NameInUseException

.. autoexception:: AMPS.NotEntitledError

.. autoexception:: AMPS.NotEntitledException

.. autoexception:: AMPS.PublishException

.. autoexception:: AMPS.PublishStoreGapException

.. autoexception:: AMPS.RetryOperation

.. autoexception:: AMPS.RetryOperationException

.. autoexception:: AMPS.StoreError

.. autoexception:: AMPS.StoreException

.. autoexception:: AMPS.StreamError

.. autoexception:: AMPS.StreamException

.. autoexception:: AMPS.SubidInUseException

.. autoexception:: AMPS.SubscriptionAlreadyExists

.. autoexception:: AMPS.SubscriptionAlreadyExistsException

.. autoexception:: AMPS.TimedOut

.. autoexception:: AMPS.TimedOutException

.. autoexception:: AMPS.TransportError

.. autoexception:: AMPS.TransportException

.. autoexception:: AMPS.TransportNotFound

.. autoexception:: AMPS.TransportTypeException

.. autoexception:: AMPS.UnknownError

.. autoexception:: AMPS.UnknownException

.. autoexception:: AMPS.UsageException
