lightstreamer-adapter


Namelightstreamer-adapter JSON
Version 1.3.1 PyPI version JSON
download
home_pagehttps://github.com/Lightstreamer/Lightstreamer-lib-python-adapter
SummaryLightstreamer SDK for Python Adapters
upload_time2023-12-11 13:39:29
maintainer
docs_urlNone
authorLightstreamer Srl
requires_python
licenseApache License 2.0
keywords lightstreamer push realtime real-time
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =====================================
Lightstreamer SDK for Python Adapters
=====================================

A Python library to  write Data Adapters and Metadata Adapters for `Lightstreamer Server`_.
The adapters will run in a separate process, communicating with the Server through the Adapter Remoting Infrastructure.

.. _Lightstreamer Server: http://www.lightstreamer.com

.. image:: https://raw.githubusercontent.com/Lightstreamer/Lightstreamer-lib-python-adapter/master/architecture.png

Use
===
Install the package:

.. code-block:: bash

   $ pip install lightstreamer-adapter

Configure Lightstreamer
-----------------------

1) Download and install Lightstreamer
2) Go to the ``adapters`` folder of your Lightstreamer Server installation. Create a new folder to deploy the remote adapters in, let's call it ``PythonAdapter``
3) Create an ``adapters.xml`` file inside the ``PythonAdapter`` folder and use the following contents (this is an example configuration, you can modify it to your liking by using the generic template, https://lightstreamer.com/docs/ls-server/latest/remote_adapter_conf_template/adapters.xml or https://lightstreamer.com/docs/ls-server/latest/remote_adapter_robust_conf_template/adapters.xml, as a reference):

   .. code-block:: xml

      <?xml version="1.0"?>
      <adapters_conf id="PROXY_PYTHON">
         <metadata_provider>
            <adapter_class>ROBUST_PROXY_FOR_REMOTE_ADAPTER</adapter_class>
            <classloader>log-enabled</classloader>
            <param name="request_reply_port">8003</param>
            <param name="timeout">36000000</param>
         </metadata_provider>
         <data_provider>
            <adapter_class>ROBUST_PROXY_FOR_REMOTE_ADAPTER</adapter_class>
            <classloader>log-enabled</classloader>
            <param name="request_reply_port">8001</param>
            <param name="timeout">36000000</param>
         </data_provider>
      </adapters_conf>

4) Take note of the ports configured in the adapters.xml file as those are needed to write the remote part of the adapters.

Write the Adapters
------------------

Create a new python module, let's call it ``adapters.py``, where we will put  the minimal logic required to write a basic Adapter Set.

1) Import the server classes needed to setup the connection to the Lightstreamer server, and the adapter classes to be extended to write your own Remote Adapters:

   .. code-block:: python
   
      from lightstreamer_adapter.server import (DataProviderServer, MetadataProviderServer)
      from lightstreamer_adapter.interfaces.data import DataProvider
      from lightstreamer_adapter.interfaces.metadata import MetadataProvider
   
2) Create a new Remote Data Adapter by subclassing the DataProvider abstract class:

   .. code-block:: python
   
      class MyDataAdapter(DataProvider):
          """This Remote Data Adapter sample class shows a simple implementation of
          the DataProvider abstract class."""
      
          def __init__(self):
              # Reference to the provided ItemEventListener instance
              self._listener = None

          def issnapshot_available(self, item_name):
              """Returns True if Snapshot information will be sent for the item_name
              item before the updates."""
              snapshot = False  # May be based on the item_name item
              return snapshot
         
          def set_listener(self, event_listener):
              """Caches the reference to the provided ItemEventListener instance."""
              self._listener = event_listener
              
          def subscribe(self, item_name):
              """Invoked to request data for an item. From now on you can start
              sending real time updates for item_name item, through invocations like
              the following:
              
              self._listener.update(item_name, {'field1': valField1,
                                                'field2': valField2}, False)
              """
              
          def unsubscribe(self, item_name):
              """Invoked to end a previous request of data for an item. From now on,
              you should stop sending updates for item_name item."""


3) Create a new Remote Metadata Adapter by subclassing the MetadataProvider class, if the latter's default behaviour does not meet your requirements, and override the methods for which you want to supply a custom implementation:

   .. code-block:: python
      
      class MyMetadataAdapter(MetadataProvider):
          """This Remote Metadata Adapter sample class shows a minimal custom
          implementation of the notify_user_message method.
          """
          
          def notify_user_message(self, user, session_id, message):
              """Invoked to forward a message received by a User"""
              print("Message {} arrived for user {} in the session {}"
                    .format(user, session_id, message))
                    
4) Run the adapters, by creating, configuring and starting the server class instances:

   .. code-block:: python
   
      if __name__ == "__main__":
          # The host of the Lightstreamer server, to be changed as required.
          LS_SERVER_HOST = 'localhost'
          
          # Creates a new MetadataProviderServer instance, passing a new
          # MyMetadataAdpater object and the remote address.
          metadata_provider_server = MetadataProviderServer(MyMetadataAdapter(),
                                                            (LS_SERVER_HOST, 8003))
          
          # Starts the server instance.
          metadata_provider_server.start()
          
          # Creates a new DataProviderServer instance, passing a new MyDataAdpater
          # object and the remote address
          data_provider_sever = DataProviderServer(MyDataAdapter(),
                                                   (LS_SERVER_HOST, 8001))
          # Starts the server instance.
          data_provider_sever.start()

5) Ensure that the main thread stays alive. This is needed, since Python 3.9, to allow the SDK library to take advantage of the system's ThreadPoolExecutor class. Here we show a simple way to do so:

   .. code-block:: python
   
      from threading import Event
      
      .....
      
      shutdown_event = Event()
      shutdown_event.wait()

Run
---

From the command line, execute:

.. code-block:: bash

   $ python adapters.py

Connect a Client
----------------

.. code-block:: javascript

    var lsClient = new LightstreamerClient(LS_SERVER_HOST, "PROXY_PYTHON");
    lsClient.connect();
    // To be completed with other client side activities, like registration of subscriptions and handling of 
    // real time updates.
    // ...
    
where ``LS_SERVER_HOST`` is the host of the Lightstreamer Server, and ``"PROXY_PYTHON"`` is the Adapter Set ID as specified in the ``adapters.xml`` file.
    
API Reference
-------------

API Reference is available at `<https://lightstreamer.com/api/ls-python-adapter/1.3.1/>`_.

You can generate it by executing the following command from the ``doc`` folder:

.. code-block:: bash

   $ make html
   
The generated documentation will be available under the ``doc\_build\html`` folder. 


See Also
=================================

- `Adapter Remoting Infrastructure Network Protocol Specification`_
- `Lightstreamer Chat Demo adapter for Python`_

.. _Adapter Remoting Infrastructure Network Protocol Specification: https://lightstreamer.com/api/ls-generic-adapter/latest/ARI%20Protocol.pdf
.. _Lightstreamer Chat Demo adapter for Python: https://github.com/Lightstreamer/Lightstreamer-example-Chat-adapter-python


Lightstreamer Compatibility Notes
=================================

Compatible with Adapter Remoting Infrastructure since Server version 7.4.
- For a version of this library compatible with Adapter Remoting Infrastructure for Server version 7,3, please refer to `this tag`_.
- For a version of this library compatible with Adapter Remoting Infrastructure for Server version 6.0 (corresponding to Adapter Remoting Infrastructure 1.7), please refer to `this older tag`_.

.. _this tag: https://github.com/Lightstreamer/Lightstreamer-lib-python-adapter/tree/version-1.2.3
.. _this older tag: https://github.com/Lightstreamer/Lightstreamer-lib-python-adapter/tree/version-1.0.0post1-27


.. :changelog:

Release History
---------------


1.3.1 (2023-12-11)
++++++++++++++++++

**Improvements**

- Stored the API docs on a different place.

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since Server version 7.4.


1.3.0 (2023-07-17)
++++++++++++++++++

**New Features**

- Introduced the support for a single connection instead of two for the
  communication of the Remote Data Adapters.
  In fact, since Server version 7.4, the Proxy Data Adapter can (and should)
  be configured to use a single connection for the communication.
  Hence, the "address" argument of __init__ for the DataProviderServer class,
  which is a tuple, can now have only 2 values (including one port); a tuple
  with 3-values will now be refused.
  As a consequence, if an existing Remote Server based on the previous
  version of this SDK launches a Remote Data Adapter, it cannot be upgraded
  to this new SDK version seamlessly.
  The upgrade will require a change in the code to supply a single
  port for the connection to the Proxy Data Adapter. This, in turn, will
  require the configuration of a single port on the Proxy Data Adapter,
  which is only possible with Lightstreamer Server 7.4 or later.
  However, if a Remote Server only launches Remote Metadata Adapters,
  the compatibility with Server version 7.3 is kept.

- Thoroughly modified the supplied unit tests to implement the single-connection
  behavior and the new compatibility rules.

**Improvements**

- Revised the supplied unit tests to clarifiy dequeueing from the sockets
  and expected messages.

- Clarified the meaning of a None or missing value for a "userMsg" argument
  supplied in a CreditsError: an empty string should be sent to the client.
  Note that, previously, the Server used to send the "null" string as a
  placeholder. Hence, Adapters relying on this behavior should now supply
  "null" explicitly.*

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since Server version 7.4.


1.2.3 (2023-03-21)
++++++++++++++++++

**Improvements**

- Added handling of runtime exceptions in the internal threads, by submitting
  them to the exception handlers and extended the default handling of runtime
  exceptions by always showing the stack trace.

- Added a unit test on keepalive packets for the notify connection.
  Also improved unit tests log to better identify the current test.

- Added documentation notes regarding the compatibility with Python 3.9 and
  later. See "start" in MetadataProviderServer and DataProviderServer.

**Bug Fixes**

- Fixed a race condition which could have caused the RAC message to be sent
  too late and break the protocol. However, this could only happen when the
  Proxy Adapter had no credential check configured.

- Addressed possible race conditions in the unit tests.

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since Server version 7.0.


1.2.2 (2021-08-30)
++++++++++++++++++

**Improvements**

- Introduced full support for Server version 7.2. Now the library can log any
  message sent by the Proxy Adapter when forcibly closing the connection.

- Modified the behavior when incomplete credentials are configured: now they
  are sent to the Proxy Adapter, whereas previously they were not sent.
  Note that, if the Proxy Adapter has credentials configured, they cannot be
  incomplete; hence the Proxy Adapter is expected to refuse the connection in
  all cases.

**Bug Fixes**

- Fixed a bug on the handling of keepalives on the notification channel of the
  Data Adapter, which may have caused the Proxy Adapter to close the connection
  due to a keepalive timeout, if configured. This had the highest probability
  to happen in case of a reduced overall data flow, or during the startup phase.

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since Server version 7.0.


1.2.1 (2021-05-25)
+++++++++++++++++++

**Improvements**

- Reformulated the compatibility constraint with respect to the Server version,
  instead of the Adapter Remoting Infrastructure version.

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since Server version 7.0.


1.2.0 (2020-01-24)
+++++++++++++++++++

**Improvements**

- Extended DataProviderServer and MetadataProviderServer (through the Server
  superclass) with settings of credentials, to be sent to the Proxy Adapter
  upon each connection. Credential check is an optional configuration of the
  Proxy Adapter; if not leveraged, the credentials will be ignored.

- Modified the handling of the keepalives when connected to a Proxy Adapter
  (i.e. Adapter Remoting Infrastructure) version 1.9
  (corresponding to Server 7.1) or higher: the preferred
  keepalive interval requested by the Proxy Adapter, when stricter than the
  configured one, is now obeyed (with a safety minimun of 1 second). Moreover,
  in that case, the default interval configuration is now 10 seconds instead of
  1. If an existing installation relies on a very short keepalive interval to
  keep the connection alive due to intermediate nodes, the time should now be
  explicitly configured.

- Added full support for ARI Protocol extensions introduced in Adapter Remoting
  Infrastructure version 1.9 (corresponding to Server 7.1).

- Added full support for TLS/SSL encrypted connections the Proxy Adapters.

- Added clarifications in the documentation of the exception handlers and fix
  a few obsolete notes.

- Added clarifications in the documentation of MetadataProviderServer and
  DataProviderServer classes.

- Improved code layout as per pylint/pycodestyle outputs.

- Remove useless "pass" statement from classes of the interfaces package.

- Updated unit tests according to new features

**Bug Fixes**

- Removed useless optional client_principal parameter from the
  MetadataProvider.notify_user method.

- Fixed documentation of the DataProvider class, where "Lightstreamer Kernel"
  was erroneously referred as "Lightstreamer1".

- Fixed broken links in the documentation of the DataProviderServer class.

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since 1.8
  (corresponding to Server 7.0).


1.1.4 (2019-03-29)
+++++++++++++++++++

**Bug Fixes**

- Fixed a bug that caused requests sent from Lightstreamer instances running on
  non-Windows platform not to be parsed correctly (see #2).

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since 1.8
  (corresponding to Server 7.0).


1.1.3 (2019-03-28)
+++++++++++++++++++

**Bug Fixes**

- Fixed parsing issue when subscribing to more than two items.

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since 1.8
  (corresponding to Server 7.0).


1.1.2 (2018-02-22)
+++++++++++++++++++

**Improvements**

- Added clarifications on licensing matters in the docs.

**Bug Fixes**

- Fixed edition note in the documentation of notify_user_with_principal.

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since 1.8
  (corresponding to Server 7.0).


1.1.1 (2017-12-22)
+++++++++++++++++++

**Improvements**

- Moved API documentation to `<http://lightstreamer-lib-python-adapter.readthedocs.io/en/latest/>`_.

- Fixed few source code fragments to make them PEP 8 compliant.

**Bug Fixes**

- Fixed Lightstreamer Compatibility Notes in the README file.

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since 1.8
  (corresponding to Server 7.0).


1.1.0 (2017-12-19)
+++++++++++++++++++

**Improvements**

- Modified the signature of the notify_mpn_device_access and
  notify_mpn_device_token_change methods of the MetadataProvider class,
  to add a session ID argument.
  Existing Remote Metadata Adapters leveraging notify_mpn_device_access
  and/or notify_mpn_device_token_change have to be ported to the new signature.

- Revised the public constants defined in the MpnPlatformType class.
  The constants referring to the supported platforms have got new names,
  whereas the constants for platforms not yet supported have been removed.
  Existing Remote Metadata Adapters explicitly referring to the constants
  have to be aligned.

- Removed the subclasses of MpnSubscriptionInfo (namely
  MpnApnsSubscriptionInfo and MpnGcmSubscriptionInfo) that were used
  by the SDK library to supply the attributes of the MPN subscriptions
  in notify_mpn_subscription_activation. Now, simple instances of
  MpnSubscriptionInfo will be supplied and attribute information can be
  obtained through the new "notification_format" property.
  See the MPN chapter on the General Concepts document for details on the
  characteristics of the Notification Format.
  Existing Remote Metadata Adapters
  leveraging notify_mpn_subscription_activation and inspecting the supplied
  MpnSubscriptionInfo have to be ported to the new class contract.

- Improved the interface documentation of MPN-related methods.

- Clarified in the docs for notifySessionClose which race conditions with other
  methods can be expected.

- Aligned the documentation to comply with current licensing policies.

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since 1.8
  (corresponding to Server 7.0).


1.0.0.post1 (2016-11-22)
++++++++++++++++++++++++

- Finishing touches on the package documentation visible from the PyPi repository


1.0.0 (2016-11-22)
+++++++++++++++++++

**Improvements**

- Updated logging messages.

**Bug Fixes**

- Fixed notification of End Of Snaphsot in case of not availability of the snapshot.

- Fixed docstrings in modules *lightstreamer_adapter/server.py* and *lightstreamer_adapter/subscription.py*.

- Fixed unit tests.

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since 1.7
  (corresponding to Server 6.0).


1.0.0b1 (2016-04-15)
+++++++++++++++++++++

**Bug Fixes**

- Fixed docstrings.

- Fixed typo in some Exceptions' message.

- Fixed unit tests.

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since 1.7
  (corresponding to Server 6.0).


1.0.0a2 (2016-04-08)
+++++++++++++++++++++

**Bug Fixes**

- Fixed return values in *lightstreamer_adapter.interfaces.metadata.MetadataProvider* class.

- Fixed default handling of I/O related errors.

- Fixed docstrings in modules *lightstreamer_adapter/data_protocol.py* and *lightstreamer_adapter/metadata_protocol.py*.

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since 1.7
  (corresponding to Server 6.0).


1.0.0a1 (2016-04-08)
+++++++++++++++++++++

**Initial release**

**Lightstreamer Compatibility Notes**

- Compatible with Adapter Remoting Infrastructure since 1.7
  (corresponding to Server 6.0).


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Lightstreamer/Lightstreamer-lib-python-adapter",
    "name": "lightstreamer-adapter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "lightstreamer push realtime real-time",
    "author": "Lightstreamer Srl",
    "author_email": "support@lightstreamer.com",
    "download_url": "https://files.pythonhosted.org/packages/9d/ed/4689bb86017238c07dc339c2c47c293237c55f816fbdac67dd6e948d5848/lightstreamer_adapter-1.3.1.zip",
    "platform": null,
    "description": "=====================================\r\nLightstreamer SDK for Python Adapters\r\n=====================================\r\n\r\nA Python library to  write Data Adapters and Metadata Adapters for `Lightstreamer Server`_.\r\nThe adapters will run in a separate process, communicating with the Server through the Adapter Remoting Infrastructure.\r\n\r\n.. _Lightstreamer Server: http://www.lightstreamer.com\r\n\r\n.. image:: https://raw.githubusercontent.com/Lightstreamer/Lightstreamer-lib-python-adapter/master/architecture.png\r\n\r\nUse\r\n===\r\nInstall the package:\r\n\r\n.. code-block:: bash\r\n\r\n   $ pip install lightstreamer-adapter\r\n\r\nConfigure Lightstreamer\r\n-----------------------\r\n\r\n1) Download and install Lightstreamer\r\n2) Go to the ``adapters`` folder of your Lightstreamer Server installation. Create a new folder to deploy the remote adapters in, let's call it ``PythonAdapter``\r\n3) Create an ``adapters.xml`` file inside the ``PythonAdapter`` folder and use the following contents (this is an example configuration, you can modify it to your liking by using the generic template, https://lightstreamer.com/docs/ls-server/latest/remote_adapter_conf_template/adapters.xml or https://lightstreamer.com/docs/ls-server/latest/remote_adapter_robust_conf_template/adapters.xml, as a reference):\r\n\r\n   .. code-block:: xml\r\n\r\n      <?xml version=\"1.0\"?>\r\n      <adapters_conf id=\"PROXY_PYTHON\">\r\n         <metadata_provider>\r\n            <adapter_class>ROBUST_PROXY_FOR_REMOTE_ADAPTER</adapter_class>\r\n            <classloader>log-enabled</classloader>\r\n            <param name=\"request_reply_port\">8003</param>\r\n            <param name=\"timeout\">36000000</param>\r\n         </metadata_provider>\r\n         <data_provider>\r\n            <adapter_class>ROBUST_PROXY_FOR_REMOTE_ADAPTER</adapter_class>\r\n            <classloader>log-enabled</classloader>\r\n            <param name=\"request_reply_port\">8001</param>\r\n            <param name=\"timeout\">36000000</param>\r\n         </data_provider>\r\n      </adapters_conf>\r\n\r\n4) Take note of the ports configured in the adapters.xml file as those are needed to write the remote part of the adapters.\r\n\r\nWrite the Adapters\r\n------------------\r\n\r\nCreate a new python module, let's call it ``adapters.py``, where we will put  the minimal logic required to write a basic Adapter Set.\r\n\r\n1) Import the server classes needed to setup the connection to the Lightstreamer server, and the adapter classes to be extended to write your own Remote Adapters:\r\n\r\n   .. code-block:: python\r\n   \r\n      from lightstreamer_adapter.server import (DataProviderServer, MetadataProviderServer)\r\n      from lightstreamer_adapter.interfaces.data import DataProvider\r\n      from lightstreamer_adapter.interfaces.metadata import MetadataProvider\r\n   \r\n2) Create a new Remote Data Adapter by subclassing the DataProvider abstract class:\r\n\r\n   .. code-block:: python\r\n   \r\n      class MyDataAdapter(DataProvider):\r\n          \"\"\"This Remote Data Adapter sample class shows a simple implementation of\r\n          the DataProvider abstract class.\"\"\"\r\n      \r\n          def __init__(self):\r\n              # Reference to the provided ItemEventListener instance\r\n              self._listener = None\r\n\r\n          def issnapshot_available(self, item_name):\r\n              \"\"\"Returns True if Snapshot information will be sent for the item_name\r\n              item before the updates.\"\"\"\r\n              snapshot = False  # May be based on the item_name item\r\n              return snapshot\r\n         \r\n          def set_listener(self, event_listener):\r\n              \"\"\"Caches the reference to the provided ItemEventListener instance.\"\"\"\r\n              self._listener = event_listener\r\n              \r\n          def subscribe(self, item_name):\r\n              \"\"\"Invoked to request data for an item. From now on you can start\r\n              sending real time updates for item_name item, through invocations like\r\n              the following:\r\n              \r\n              self._listener.update(item_name, {'field1': valField1,\r\n                                                'field2': valField2}, False)\r\n              \"\"\"\r\n              \r\n          def unsubscribe(self, item_name):\r\n              \"\"\"Invoked to end a previous request of data for an item. From now on,\r\n              you should stop sending updates for item_name item.\"\"\"\r\n\r\n\r\n3) Create a new Remote Metadata Adapter by subclassing the MetadataProvider class, if the latter's default behaviour does not meet your requirements, and override the methods for which you want to supply a custom implementation:\r\n\r\n   .. code-block:: python\r\n      \r\n      class MyMetadataAdapter(MetadataProvider):\r\n          \"\"\"This Remote Metadata Adapter sample class shows a minimal custom\r\n          implementation of the notify_user_message method.\r\n          \"\"\"\r\n          \r\n          def notify_user_message(self, user, session_id, message):\r\n              \"\"\"Invoked to forward a message received by a User\"\"\"\r\n              print(\"Message {} arrived for user {} in the session {}\"\r\n                    .format(user, session_id, message))\r\n                    \r\n4) Run the adapters, by creating, configuring and starting the server class instances:\r\n\r\n   .. code-block:: python\r\n   \r\n      if __name__ == \"__main__\":\r\n          # The host of the Lightstreamer server, to be changed as required.\r\n          LS_SERVER_HOST = 'localhost'\r\n          \r\n          # Creates a new MetadataProviderServer instance, passing a new\r\n          # MyMetadataAdpater object and the remote address.\r\n          metadata_provider_server = MetadataProviderServer(MyMetadataAdapter(),\r\n                                                            (LS_SERVER_HOST, 8003))\r\n          \r\n          # Starts the server instance.\r\n          metadata_provider_server.start()\r\n          \r\n          # Creates a new DataProviderServer instance, passing a new MyDataAdpater\r\n          # object and the remote address\r\n          data_provider_sever = DataProviderServer(MyDataAdapter(),\r\n                                                   (LS_SERVER_HOST, 8001))\r\n          # Starts the server instance.\r\n          data_provider_sever.start()\r\n\r\n5) Ensure that the main thread stays alive. This is needed, since Python 3.9, to allow the SDK library to take advantage of the system's ThreadPoolExecutor class. Here we show a simple way to do so:\r\n\r\n   .. code-block:: python\r\n   \r\n      from threading import Event\r\n      \r\n      .....\r\n      \r\n      shutdown_event = Event()\r\n      shutdown_event.wait()\r\n\r\nRun\r\n---\r\n\r\nFrom the command line, execute:\r\n\r\n.. code-block:: bash\r\n\r\n   $ python adapters.py\r\n\r\nConnect a Client\r\n----------------\r\n\r\n.. code-block:: javascript\r\n\r\n    var lsClient = new LightstreamerClient(LS_SERVER_HOST, \"PROXY_PYTHON\");\r\n    lsClient.connect();\r\n    // To be completed with other client side activities, like registration of subscriptions and handling of \r\n    // real time updates.\r\n    // ...\r\n    \r\nwhere ``LS_SERVER_HOST`` is the host of the Lightstreamer Server, and ``\"PROXY_PYTHON\"`` is the Adapter Set ID as specified in the ``adapters.xml`` file.\r\n    \r\nAPI Reference\r\n-------------\r\n\r\nAPI Reference is available at `<https://lightstreamer.com/api/ls-python-adapter/1.3.1/>`_.\r\n\r\nYou can generate it by executing the following command from the ``doc`` folder:\r\n\r\n.. code-block:: bash\r\n\r\n   $ make html\r\n   \r\nThe generated documentation will be available under the ``doc\\_build\\html`` folder. \r\n\r\n\r\nSee Also\r\n=================================\r\n\r\n- `Adapter Remoting Infrastructure Network Protocol Specification`_\r\n- `Lightstreamer Chat Demo adapter for Python`_\r\n\r\n.. _Adapter Remoting Infrastructure Network Protocol Specification: https://lightstreamer.com/api/ls-generic-adapter/latest/ARI%20Protocol.pdf\r\n.. _Lightstreamer Chat Demo adapter for Python: https://github.com/Lightstreamer/Lightstreamer-example-Chat-adapter-python\r\n\r\n\r\nLightstreamer Compatibility Notes\r\n=================================\r\n\r\nCompatible with Adapter Remoting Infrastructure since Server version 7.4.\r\n- For a version of this library compatible with Adapter Remoting Infrastructure for Server version 7,3, please refer to `this tag`_.\r\n- For a version of this library compatible with Adapter Remoting Infrastructure for Server version 6.0 (corresponding to Adapter Remoting Infrastructure 1.7), please refer to `this older tag`_.\r\n\r\n.. _this tag: https://github.com/Lightstreamer/Lightstreamer-lib-python-adapter/tree/version-1.2.3\r\n.. _this older tag: https://github.com/Lightstreamer/Lightstreamer-lib-python-adapter/tree/version-1.0.0post1-27\r\n\r\n\r\n.. :changelog:\r\n\r\nRelease History\r\n---------------\r\n\r\n\r\n1.3.1 (2023-12-11)\r\n++++++++++++++++++\r\n\r\n**Improvements**\r\n\r\n- Stored the API docs on a different place.\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since Server version 7.4.\r\n\r\n\r\n1.3.0 (2023-07-17)\r\n++++++++++++++++++\r\n\r\n**New Features**\r\n\r\n- Introduced the support for a single connection instead of two for the\r\n  communication of the Remote Data Adapters.\r\n  In fact, since Server version 7.4, the Proxy Data Adapter can (and should)\r\n  be configured to use a single connection for the communication.\r\n  Hence, the \"address\" argument of __init__ for the DataProviderServer class,\r\n  which is a tuple, can now have only 2 values (including one port); a tuple\r\n  with 3-values will now be refused.\r\n  As a consequence, if an existing Remote Server based on the previous\r\n  version of this SDK launches a Remote Data Adapter, it cannot be upgraded\r\n  to this new SDK version seamlessly.\r\n  The upgrade will require a change in the code to supply a single\r\n  port for the connection to the Proxy Data Adapter. This, in turn, will\r\n  require the configuration of a single port on the Proxy Data Adapter,\r\n  which is only possible with Lightstreamer Server 7.4 or later.\r\n  However, if a Remote Server only launches Remote Metadata Adapters,\r\n  the compatibility with Server version 7.3 is kept.\r\n\r\n- Thoroughly modified the supplied unit tests to implement the single-connection\r\n  behavior and the new compatibility rules.\r\n\r\n**Improvements**\r\n\r\n- Revised the supplied unit tests to clarifiy dequeueing from the sockets\r\n  and expected messages.\r\n\r\n- Clarified the meaning of a None or missing value for a \"userMsg\" argument\r\n  supplied in a CreditsError: an empty string should be sent to the client.\r\n  Note that, previously, the Server used to send the \"null\" string as a\r\n  placeholder. Hence, Adapters relying on this behavior should now supply\r\n  \"null\" explicitly.*\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since Server version 7.4.\r\n\r\n\r\n1.2.3 (2023-03-21)\r\n++++++++++++++++++\r\n\r\n**Improvements**\r\n\r\n- Added handling of runtime exceptions in the internal threads, by submitting\r\n  them to the exception handlers and extended the default handling of runtime\r\n  exceptions by always showing the stack trace.\r\n\r\n- Added a unit test on keepalive packets for the notify connection.\r\n  Also improved unit tests log to better identify the current test.\r\n\r\n- Added documentation notes regarding the compatibility with Python 3.9 and\r\n  later. See \"start\" in MetadataProviderServer and DataProviderServer.\r\n\r\n**Bug Fixes**\r\n\r\n- Fixed a race condition which could have caused the RAC message to be sent\r\n  too late and break the protocol. However, this could only happen when the\r\n  Proxy Adapter had no credential check configured.\r\n\r\n- Addressed possible race conditions in the unit tests.\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since Server version 7.0.\r\n\r\n\r\n1.2.2 (2021-08-30)\r\n++++++++++++++++++\r\n\r\n**Improvements**\r\n\r\n- Introduced full support for Server version 7.2. Now the library can log any\r\n  message sent by the Proxy Adapter when forcibly closing the connection.\r\n\r\n- Modified the behavior when incomplete credentials are configured: now they\r\n  are sent to the Proxy Adapter, whereas previously they were not sent.\r\n  Note that, if the Proxy Adapter has credentials configured, they cannot be\r\n  incomplete; hence the Proxy Adapter is expected to refuse the connection in\r\n  all cases.\r\n\r\n**Bug Fixes**\r\n\r\n- Fixed a bug on the handling of keepalives on the notification channel of the\r\n  Data Adapter, which may have caused the Proxy Adapter to close the connection\r\n  due to a keepalive timeout, if configured. This had the highest probability\r\n  to happen in case of a reduced overall data flow, or during the startup phase.\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since Server version 7.0.\r\n\r\n\r\n1.2.1 (2021-05-25)\r\n+++++++++++++++++++\r\n\r\n**Improvements**\r\n\r\n- Reformulated the compatibility constraint with respect to the Server version,\r\n  instead of the Adapter Remoting Infrastructure version.\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since Server version 7.0.\r\n\r\n\r\n1.2.0 (2020-01-24)\r\n+++++++++++++++++++\r\n\r\n**Improvements**\r\n\r\n- Extended DataProviderServer and MetadataProviderServer (through the Server\r\n  superclass) with settings of credentials, to be sent to the Proxy Adapter\r\n  upon each connection. Credential check is an optional configuration of the\r\n  Proxy Adapter; if not leveraged, the credentials will be ignored.\r\n\r\n- Modified the handling of the keepalives when connected to a Proxy Adapter\r\n  (i.e. Adapter Remoting Infrastructure) version 1.9\r\n  (corresponding to Server 7.1) or higher: the preferred\r\n  keepalive interval requested by the Proxy Adapter, when stricter than the\r\n  configured one, is now obeyed (with a safety minimun of 1 second). Moreover,\r\n  in that case, the default interval configuration is now 10 seconds instead of\r\n  1. If an existing installation relies on a very short keepalive interval to\r\n  keep the connection alive due to intermediate nodes, the time should now be\r\n  explicitly configured.\r\n\r\n- Added full support for ARI Protocol extensions introduced in Adapter Remoting\r\n  Infrastructure version 1.9 (corresponding to Server 7.1).\r\n\r\n- Added full support for TLS/SSL encrypted connections the Proxy Adapters.\r\n\r\n- Added clarifications in the documentation of the exception handlers and fix\r\n  a few obsolete notes.\r\n\r\n- Added clarifications in the documentation of MetadataProviderServer and\r\n  DataProviderServer classes.\r\n\r\n- Improved code layout as per pylint/pycodestyle outputs.\r\n\r\n- Remove useless \"pass\" statement from classes of the interfaces package.\r\n\r\n- Updated unit tests according to new features\r\n\r\n**Bug Fixes**\r\n\r\n- Removed useless optional client_principal parameter from the\r\n  MetadataProvider.notify_user method.\r\n\r\n- Fixed documentation of the DataProvider class, where \"Lightstreamer Kernel\"\r\n  was erroneously referred as \"Lightstreamer1\".\r\n\r\n- Fixed broken links in the documentation of the DataProviderServer class.\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since 1.8\r\n  (corresponding to Server 7.0).\r\n\r\n\r\n1.1.4 (2019-03-29)\r\n+++++++++++++++++++\r\n\r\n**Bug Fixes**\r\n\r\n- Fixed a bug that caused requests sent from Lightstreamer instances running on\r\n  non-Windows platform not to be parsed correctly (see #2).\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since 1.8\r\n  (corresponding to Server 7.0).\r\n\r\n\r\n1.1.3 (2019-03-28)\r\n+++++++++++++++++++\r\n\r\n**Bug Fixes**\r\n\r\n- Fixed parsing issue when subscribing to more than two items.\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since 1.8\r\n  (corresponding to Server 7.0).\r\n\r\n\r\n1.1.2 (2018-02-22)\r\n+++++++++++++++++++\r\n\r\n**Improvements**\r\n\r\n- Added clarifications on licensing matters in the docs.\r\n\r\n**Bug Fixes**\r\n\r\n- Fixed edition note in the documentation of notify_user_with_principal.\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since 1.8\r\n  (corresponding to Server 7.0).\r\n\r\n\r\n1.1.1 (2017-12-22)\r\n+++++++++++++++++++\r\n\r\n**Improvements**\r\n\r\n- Moved API documentation to `<http://lightstreamer-lib-python-adapter.readthedocs.io/en/latest/>`_.\r\n\r\n- Fixed few source code fragments to make them PEP 8 compliant.\r\n\r\n**Bug Fixes**\r\n\r\n- Fixed Lightstreamer Compatibility Notes in the README file.\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since 1.8\r\n  (corresponding to Server 7.0).\r\n\r\n\r\n1.1.0 (2017-12-19)\r\n+++++++++++++++++++\r\n\r\n**Improvements**\r\n\r\n- Modified the signature of the notify_mpn_device_access and\r\n  notify_mpn_device_token_change methods of the MetadataProvider class,\r\n  to add a session ID argument.\r\n  Existing Remote Metadata Adapters leveraging notify_mpn_device_access\r\n  and/or notify_mpn_device_token_change have to be ported to the new signature.\r\n\r\n- Revised the public constants defined in the MpnPlatformType class.\r\n  The constants referring to the supported platforms have got new names,\r\n  whereas the constants for platforms not yet supported have been removed.\r\n  Existing Remote Metadata Adapters explicitly referring to the constants\r\n  have to be aligned.\r\n\r\n- Removed the subclasses of MpnSubscriptionInfo (namely\r\n  MpnApnsSubscriptionInfo and MpnGcmSubscriptionInfo) that were used\r\n  by the SDK library to supply the attributes of the MPN subscriptions\r\n  in notify_mpn_subscription_activation. Now, simple instances of\r\n  MpnSubscriptionInfo will be supplied and attribute information can be\r\n  obtained through the new \"notification_format\" property.\r\n  See the MPN chapter on the General Concepts document for details on the\r\n  characteristics of the Notification Format.\r\n  Existing Remote Metadata Adapters\r\n  leveraging notify_mpn_subscription_activation and inspecting the supplied\r\n  MpnSubscriptionInfo have to be ported to the new class contract.\r\n\r\n- Improved the interface documentation of MPN-related methods.\r\n\r\n- Clarified in the docs for notifySessionClose which race conditions with other\r\n  methods can be expected.\r\n\r\n- Aligned the documentation to comply with current licensing policies.\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since 1.8\r\n  (corresponding to Server 7.0).\r\n\r\n\r\n1.0.0.post1 (2016-11-22)\r\n++++++++++++++++++++++++\r\n\r\n- Finishing touches on the package documentation visible from the PyPi repository\r\n\r\n\r\n1.0.0 (2016-11-22)\r\n+++++++++++++++++++\r\n\r\n**Improvements**\r\n\r\n- Updated logging messages.\r\n\r\n**Bug Fixes**\r\n\r\n- Fixed notification of End Of Snaphsot in case of not availability of the snapshot.\r\n\r\n- Fixed docstrings in modules *lightstreamer_adapter/server.py* and *lightstreamer_adapter/subscription.py*.\r\n\r\n- Fixed unit tests.\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since 1.7\r\n  (corresponding to Server 6.0).\r\n\r\n\r\n1.0.0b1 (2016-04-15)\r\n+++++++++++++++++++++\r\n\r\n**Bug Fixes**\r\n\r\n- Fixed docstrings.\r\n\r\n- Fixed typo in some Exceptions' message.\r\n\r\n- Fixed unit tests.\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since 1.7\r\n  (corresponding to Server 6.0).\r\n\r\n\r\n1.0.0a2 (2016-04-08)\r\n+++++++++++++++++++++\r\n\r\n**Bug Fixes**\r\n\r\n- Fixed return values in *lightstreamer_adapter.interfaces.metadata.MetadataProvider* class.\r\n\r\n- Fixed default handling of I/O related errors.\r\n\r\n- Fixed docstrings in modules *lightstreamer_adapter/data_protocol.py* and *lightstreamer_adapter/metadata_protocol.py*.\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since 1.7\r\n  (corresponding to Server 6.0).\r\n\r\n\r\n1.0.0a1 (2016-04-08)\r\n+++++++++++++++++++++\r\n\r\n**Initial release**\r\n\r\n**Lightstreamer Compatibility Notes**\r\n\r\n- Compatible with Adapter Remoting Infrastructure since 1.7\r\n  (corresponding to Server 6.0).\r\n\r\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Lightstreamer SDK for Python Adapters",
    "version": "1.3.1",
    "project_urls": {
        "Homepage": "https://github.com/Lightstreamer/Lightstreamer-lib-python-adapter"
    },
    "split_keywords": [
        "lightstreamer",
        "push",
        "realtime",
        "real-time"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9ded4689bb86017238c07dc339c2c47c293237c55f816fbdac67dd6e948d5848",
                "md5": "ad7925495282b8103bf794478abe89ad",
                "sha256": "0ee021ad036d6bd283bd6ddc8b1ff37e18afd77e27eff4551b9d1140161e281b"
            },
            "downloads": -1,
            "filename": "lightstreamer_adapter-1.3.1.zip",
            "has_sig": false,
            "md5_digest": "ad7925495282b8103bf794478abe89ad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 142256,
            "upload_time": "2023-12-11T13:39:29",
            "upload_time_iso_8601": "2023-12-11T13:39:29.355934Z",
            "url": "https://files.pythonhosted.org/packages/9d/ed/4689bb86017238c07dc339c2c47c293237c55f816fbdac67dd6e948d5848/lightstreamer_adapter-1.3.1.zip",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-11 13:39:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Lightstreamer",
    "github_project": "Lightstreamer-lib-python-adapter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "lightstreamer-adapter"
}
        
Elapsed time: 0.16654s