-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update documentation and clean up some old dependencies. (#244)
- Loading branch information
1 parent
1fcedbf
commit 1018068
Showing
9 changed files
with
59 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
**************************************** | ||
Event Callbacks | ||
**************************************** | ||
|
||
The Unleash Python client support event callbacks! | ||
|
||
1. Create a function with the type `Callable[[UnleashEvent]]` and pass it to the Unleash client at initialization. | ||
2. Enable `impression data <https://docs.getunleash.io/reference/impression-data#enabling-impression-data>`_ on feature flag configuration. | ||
|
||
Example code using `blinker <https://github.com/pallets-eco/blinker>`_: | ||
|
||
.. code-block:: python | ||
from blinker import ignal | ||
from UnleashClient import UnleashClient | ||
from UnleashClient.events import UnleashEvent | ||
send_data = signal('send-data') | ||
@send_data.connect | ||
def receive_data(sender, **kw): | ||
print("Caught signal from %r, data %r" % (sender, kw)) | ||
return kw | ||
def example_callback(event: UnleashEvent): | ||
send_data.send('anonymous', data=event) | ||
# Set up Unleash | ||
client = UnleashClient( | ||
"https://unleash.herokuapp.com/api", | ||
"My Program" | ||
event_callback=example_callback | ||
) | ||
client.initialize_client() | ||
client.is_enabled("testFlag") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters