Skip to main content

LaunchDarkly SSE Client

Project description

LaunchDarkly SSE Client for Python

Run CI PyPI readthedocs

Overview

The launchdarkly/python-eventsource package allows Python developers to consume Server-Sent-Events (SSE) from a remote API. The SSE specification is defined here: https://html.spec.whatwg.org/multipage/server-sent-events.html

This package's primary purpose is to support the LaunchDarkly SDK for Python, but it can be used independently. In its simplest configuration, it emulates the behavior of the EventSource API as defined in the SSE specification, with the addition of exponential backoff behavior for retries. However, it also includes optional features used by LaunchDarkly SDKs that are not part of the core specification, such as:

  • Customizing the backoff/jitter behavior.
  • Setting read timeouts, custom headers, and other HTTP request properties.
  • Specifying that connections should be retried under circumstances where the standard EventSource behavior would not retry them, such as if the server returns an HTTP error status.

The default SSEClient is a synchronous implementation which blocks the caller's thread when reading events or reconnecting. By default, it uses urllib3 to make HTTP requests, but it can be configured to read any input stream.

An async implementation, AsyncSSEClient, is also available for use with asyncio-based applications. It uses aiohttp for HTTP and requires installing the optional async extra:

pip install launchdarkly-eventsource[async]

[!CAUTION] The async implementation (AsyncSSEClient and its associated AsyncConnectStrategy API) is experimental and should NOT be considered ready for production use. It may change or be removed without notice and is not subject to backwards compatibility guarantees.

Pin to a specific minor version and review the changelog before upgrading.

Supported Python versions

This version of the package is compatible with Python 3.9 and higher.

Contributing

We encourage pull requests and other contributions from the community. Check out our contributing guidelines for instructions on how to contribute to this SDK.

About LaunchDarkly

  • LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
    • Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
    • Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
    • Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
    • Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
  • LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read our documentation for a complete list.
  • Explore LaunchDarkly

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

launchdarkly_eventsource-1.6.0.tar.gz (45.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

launchdarkly_eventsource-1.6.0-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file launchdarkly_eventsource-1.6.0.tar.gz.

File metadata

  • Download URL: launchdarkly_eventsource-1.6.0.tar.gz
  • Upload date:
  • Size: 45.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for launchdarkly_eventsource-1.6.0.tar.gz
Algorithm Hash digest
SHA256 21fea247f4236029ed60d5ae1c433ab2c0fe00e83bd1ecd22a2e5b0f993eafed
MD5 9df1d8e36cf57cec75abbe77c9d29052
BLAKE2b-256 401a69e3d31e55f0355365a69cf483e3155272a8f8b7eb6875b5174d145ba3cd

See more details on using hashes here.

File details

Details for the file launchdarkly_eventsource-1.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for launchdarkly_eventsource-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9e29c0e03f4bd12f279e969fd9fd0a2ae081019f20c0b797a0f9c3fd7b6d65e
MD5 f345e01287f003c44b8ec04b9f94ee41
BLAKE2b-256 1143d833bf4a1213392c7fe20b2f0fae3bbc07e406ff5136ab15329c8bbf1d07

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page