Skip to content

Commit 3f1990c

Browse files
author
Dave Johnston
authored
Merge pull request #24 from harness/readme_updates
Simplify the README
2 parents 1e5fa5f + 642d796 commit 3f1990c

File tree

1 file changed

+9
-32
lines changed

1 file changed

+9
-32
lines changed

README.md

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -32,40 +32,17 @@ Harness Feature Flags (FF) is a feature management solution that enables users t
3232
The Feature Flag SDK provides a client that connects to the feature flag service, and fetches the value
3333
of featue flags. The following section provides an example of how to install the SDK and initalize it from
3434
an application.
35-
This quickstart assumes you have followed the instructions to [setup a Feature Flag project and have created a flag called `simpleboolflag` and created a server API Key](https://ngdocs.harness.io/article/1j7pdkqh7j-create-a-feature-flag#step_1_create_a_project).
35+
This quickstart assumes you have followed the instructions to [setup a Feature Flag project and have created a flag called `harnessappdemodarkmode` and created a server API Key](https://ngdocs.harness.io/article/1j7pdkqh7j-create-a-feature-flag#step_1_create_a_project).
3636

3737
### Install the SDK
3838
Install the python SDK using pip
3939
```python
4040
python -m pip install harness-featureflags
4141
```
4242

43-
### Initialize the SDK
44-
To intialize the SDK you need to provide an API Key.
45-
```python
46-
client = CfClient("c9b3f14f-6336-4d23-83b4-73f29d1ebefa")
47-
```
48-
49-
### Setup a Target
50-
The client will evaluate a flag and return the value. A target must be provided for the evaluation.
51-
If no special [target rules](https://ngdocs.harness.io/article/xf3hmxbaji-targeting-users-with-flags) have been added in the feature flag service for the target, then the flag defaults will be returned.
52-
To create a target do the following - provide an identifier and (optionally) a friendly name. When the client authenticates with the feature flag service it will automatically register the target if it doesn't exist:
53-
```python
54-
target = Target(identifier='mytarget', name="FriendlyName")
55-
```
56-
57-
58-
59-
### Evaluate the Flag
60-
You can now call one of the evaluate functions, to get the value of a flag. Incase there is an error you
61-
can specify the default that should be returned.
62-
```python
63-
result = client.bool_variation('simpleboolflag', target, False)
64-
```
65-
66-
### Working Example
67-
Here is a complete example that will connect and report the flag value every 10 seconds until the connection is clsed. Any time a flag is
68-
toggled from the feature flag service you will receive the updated value.
43+
### A Simple Example
44+
Here is a complete example that will connect to the feature flag service and report the flag value every 10 seconds until the connection is closed.
45+
Any time a flag is toggled from the feature flag service you will receive the updated value.
6946

7047
```python
7148
import time
@@ -77,10 +54,11 @@ from featureflags.util import log
7754

7855

7956
def main():
57+
# API Key
58+
apiKey = "c9b3f14f-6336-4d23-83b4-73f29d1ebeeb"
59+
8060
# Create a Feature Flag Client
81-
client = CfClient("c9b3f14f-6336-4d23-83b4-73f29d1ebeeb",
82-
with_base_url("https://config.ff.harness.io/api/1.0"),
83-
with_events_url("https://events.ff.harness.io/api/1.0"))
61+
client = CfClient(apiKey)
8462

8563
# Create a target (different targets can get different results based on rules)
8664
target = Target(identifier='mytarget', name="FriendlyName")
@@ -99,10 +77,9 @@ if __name__ == "__main__":
9977
```
10078

10179
### Running the example
102-
You can save the above to a file called `sdk_sample.py` and run with
10380

10481
```bash
105-
$ python sdk_sample.py
82+
$ python3 examples/basic_example/basic.py
10683
```
10784

10885
### Additional Reading

0 commit comments

Comments
 (0)