File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,26 @@ provider = FlagsmithProvider(
5757)
5858```
5959
60- The provider can then be used with the OpenFeature client as per
60+ The provider can then be used with the OpenFeature client as per
6161[ the documentation] ( https://openfeature.dev/docs/reference/concepts/evaluation-api#setting-a-provider ) .
6262
63+ ### Evaluation Context
64+
65+ The evaluation context supports traits in two ways:
66+ 1 . Flat top-level attributes
67+ 2 . A nested traits object
68+
69+ The two forms are merged and sent to Flagsmith, with the traits object taking precedence if keys conflict.
70+
71+ ``` python
72+ context = EvaluationContext( # Traits are: {"abc":"def", "foo": "bar2"}
73+ targeting_key = " user" ,
74+ attributes = {
75+ " foo" : " bar" ,
76+ " abc" : " def" ,
77+ " traits" : {" foo" : " bar2" }
78+ },
79+ )
80+
81+ ```
82+
You can’t perform that action at this time.
0 commit comments