File tree Expand file tree Collapse file tree 7 files changed +17
-18
lines changed Expand file tree Collapse file tree 7 files changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -65,16 +65,14 @@ def main():
6565 client = CfClient(apiKey)
6666
6767 # Create a target (different targets can get different results based on rules. This include a custom attribute 'location')
68- target = Target(identifier = ' pythonSDK ' , name = " PythonSDK " , attributes = {" location" : " emea" })
68+ target = Target(identifier = ' HT_1 ' , name = " Harness_Target_1 " , attributes = {" location" : " emea" })
6969
7070 # Loop forever reporting the state of the flag
7171 while True :
7272 result = client.bool_variation(flagName, target, False )
7373 log.info(" Flag variation %s " , result)
7474 time.sleep(10 )
7575
76- close()
77-
7876
7977if __name__ == " __main__" :
8078 main()
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ def main():
99 api_key = "Your API Key"
1010 client = CfClient (api_key )
1111
12- target = Target (identifier = 'harness' )
12+ target = Target (identifier = 'HT_1' , name = "Harness_Target_1" , attributes = { "location" : "emea" } )
1313
1414 while True :
1515 result = client .bool_variation ('identifier_of_your_bool_flag' , target , False )
Original file line number Diff line number Diff line change @@ -9,10 +9,10 @@ def main():
99 api_key = "Your API key"
1010 client = CfClient (api_key )
1111
12- target = Target (identifier = 'harness' )
12+ target = Target (identifier = 'HT_1' , name = "Harness_Target_1" , attributes = { "location" : "emea" } )
1313
1414 for x in range (10 ):
15- result = client .bool_variation ('your_flag_identifier ' , target , False )
15+ result = client .bool_variation ('harnessappdemodarkmode ' , target , False )
1616 log .debug ("Result %s" , result )
1717 time .sleep (10 )
1818
Original file line number Diff line number Diff line change 77
88
99# API Key
10- apiKey = os .getenv ('FF_API_KEY' , "" )
10+ api_key = os .getenv ('FF_API_KEY' , "" )
1111
1212# Flag Name
1313flagName = os .getenv ('FF_FLAG_NAME' , "harnessappdemodarkmode" )
1414
1515def main ():
1616 log .info ("Harness SDK Getting Started" )
1717 # Create a Feature Flag Client
18- client = CfClient (apiKey )
18+ client = CfClient (api_key )
1919
2020
2121 # Create a target (different targets can get different results based on rules)
22- target = Target (identifier = 'pythonSDK ' , name = "PythonSDK " , attributes = {"location" : "emea" })
22+ target = Target (identifier = 'HT_1 ' , name = "Harness_Target_1 " , attributes = {"location" : "emea" })
2323
2424 # Loop forever reporting the state of the flag
2525 while True :
2626 result = client .bool_variation (flagName , target , False )
2727 log .info ("%s flag variation %s" , flagName , result )
2828 time .sleep (10 )
2929
30- close ()
3130
3231
3332if __name__ == "__main__" :
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ def main():
99 api_key = "Your API Key"
1010 client = CfClient (api_key )
1111
12- target = Target (identifier = 'harness' )
12+ target = Target (identifier = 'HT_1' , name = "Harness_Target_1" , attributes = { "location" : "emea" } )
1313
1414 while True :
1515 result = client .json_variation ('identifier_of_your_json_flag' , target , {})
Original file line number Diff line number Diff line change 1+ import os
12import time
23
34from featureflags .client import CfClient
45from featureflags .config import *
56from featureflags .evaluations .auth_target import Target
67from featureflags .util import log
78
9+ api_key = os .getenv ('FF_API_KEY' , "" )
810
911def main ():
1012 # Create a Feature Flag Client
11- client = CfClient ("c9b3f14f-6336-4d23-83b4-73f29d1ebeeb" )
13+ client = CfClient (apiKey )
1214
1315 # Create a target (different targets can get different results based on rules that you add in the UI).
14- target = Target (identifier = 'mytarget ' , name = "FriendlyName" )
16+ target = Target (identifier = 'HT_1 ' , name = "Harness_Target_1" , attributes = { "location" : "emea" } )
1517
1618 # Loop forever reporting the state of the flag. If there is an error the default value will be returned
1719 while True :
18- result = client .bool_variation ('simpleboolflag ' , target , False )
20+ result = client .bool_variation ('harnessappdemodarkmode ' , target , False )
1921 log .info ("Flag variation %s" , result )
2022 time .sleep (10 )
2123
22- close ()
2324
2425
2526if __name__ == "__main__" :
Original file line number Diff line number Diff line change 1+ import os
12import time
23
34from featureflags .evaluations .auth_target import Target
910
1011def main ():
1112 log .debug ("Starting example" )
12- api_key = "Your API key"
13+ api_key = os . getenv ( 'FF_API_KEY' , "" )
1314 client = CfClient (api_key ,
1415 with_base_url ("https://config.ff.harness.io/api/1.0" ),
1516 with_events_url ("https://events.ff.harness.io/api/1.0" ))
1617
17- target = Target (identifier = 'harness' )
18+ target = Target (identifier = 'HT_1' , name = "Harness_Target_1" , attributes = { "location" : "emea" } )
1819
1920 while True :
20- result = client .bool_variation ('your_flag_identifier ' , target , False )
21+ result = client .bool_variation ('harnessappdemodarkmode ' , target , False )
2122 log .debug ("Result %s" , result )
2223 time .sleep (10 )
2324
You can’t perform that action at this time.
0 commit comments