An open API service indexing awesome lists of open source software.

https://github.com/splitio/wrapped-python


https://github.com/splitio/wrapped-python

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          

# wrapped-python

## Compatibility

This SDK is compatible with **Python 3 and higher**.

## Getting started

Below is a simple example that describes the instantiation and most basic usage of our SDK:

Run `pip install splitio_client>=9.1.1`

```python
from splitio_wrapper import get_factory
from splitio.exceptions import TimeoutException

factory = get_factory('YOUR_SDK_TYPE_API_KEY', config=config)
try:
factory.block_until_ready(5) # wait up to 5 seconds
split = factory.client()
treatment = split.get_treatment('CUSTOMER_ID', 'SPLIT_NAME')
if treatment == "on":
# insert code here to show on treatment
elif treatment == "off":
# insert code here to show off treatment
else:
# insert your control treatment code here
except TimeoutException:
# Now the user can choose whether to abort the whole execution, or just keep going
# without a ready client, which if configured properly, should become ready at some point.
pass
```

If you want to bypass evaluations you can call the method `disable_evaluations()` and you can turn it back by calling `enabling_evaluations()`

```python
split.disable_evaluations() # After disabling, everything will return Control

split.enable_evaluations() # After enabling, all the logic will be done again to evaluate features
```

```python
from splitio_wrapper import get_factory

factory = get_factory('YOUR_SDK_TYPE_API_KEY', config=config)
split = factory.client()
split.disable_evaluations() if disable_redis else split.enable_evaluations()
```