@@ -142,11 +142,11 @@ If the flag management system you're using supports targeting, you can provide t
142142``` python
143143from openfeature.api import (
144144 get_client,
145- get_provider,
146145 set_provider,
147146 get_evaluation_context,
148147 set_evaluation_context,
149148)
149+ from openfeature.evaluation_context import EvaluationContext
150150
151151global_context = EvaluationContext(
152152 targeting_key = " targeting_key1" , attributes = {" application" : " value1" }
@@ -159,7 +159,7 @@ request_context = EvaluationContext(
159159set_evaluation_context(global_context)
160160
161161# merge second context
162- client = get_client(name = " No-op Provider" )
162+ client = get_client(domain = " No-op Provider" )
163163client.get_string_value(" email" , " fallback" , request_context)
164164```
165165
@@ -172,19 +172,20 @@ If the hook you're looking for hasn't been created yet, see the [develop a hook]
172172Once you've added a hook as a dependency, it can be registered at the global, client, or flag invocation level.
173173
174174``` python
175+ from openfeature import api
175176from openfeature.api import add_hooks
176177from openfeature.flag_evaluation import FlagEvaluationOptions
177178
178179# set global hooks at the API-level
179180add_hooks([MyHook()])
180181
181182# or configure them in the client
182- client = OpenFeatureClient ()
183+ client = api.get_client ()
183184client.add_hooks([MyHook()])
184185
185186# or at the invocation-level
186187options = FlagEvaluationOptions(hooks = [MyHook()])
187- client.get_boolean_flag (" my-flag" , False , flag_evaluation_options = options)
188+ client.get_boolean_value (" my-flag" , False , flag_evaluation_options = options)
188189```
189190### Tracking
190191
@@ -254,7 +255,7 @@ Please refer to the documentation of the provider you're using to see what event
254255
255256``` python
256257from openfeature import api
257- from openfeature.provider import ProviderEvent
258+ from openfeature.event import EventDetails, ProviderEvent
258259
259260def on_provider_ready (event_details : EventDetails):
260261 print (f " Provider { event_details.provider_name} is ready " )
@@ -503,10 +504,11 @@ Implement your own hook by creating a hook that inherits from the `Hook` class.
503504Any of the evaluation life-cycle stages (` before ` /` after ` /` error ` /` finally_after ` ) can be override to add the desired business logic.
504505
505506``` python
506- from openfeature.hook import Hook
507+ from openfeature.hook import Hook, HookContext, HookHints
508+ from openfeature.flag_evaluation import FlagEvaluationDetails
507509
508510class MyHook (Hook ):
509- def after (self , hook_context : HookContext, details : FlagEvaluationDetails, hints : dict ):
511+ def after (self , hook_context : HookContext, details : FlagEvaluationDetails, hints : HookHints ):
510512 print (" This runs after the flag has been evaluated" )
511513
512514```
0 commit comments