Skip to content

Commit 411bc90

Browse files
committed
fix: readme and usage examples
1 parent 20feae6 commit 411bc90

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

README.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ See the [documentation](https://docs.knock.app) for Python usage examples.
1111
To install from PyPi, run the following:
1212

1313
```bash
14-
pip install knock-py
14+
pip install knockapi
1515
```
1616

1717
To install from source, clone the repo and run the following:
@@ -25,7 +25,43 @@ python setup.py install
2525
To use the library you must provide a secret API key, provided in the Knock dashboard.
2626

2727
```python
28-
import knock
28+
from knockapi import Knock
29+
client = Knock(api_key="sk_12345")
30+
```
31+
32+
## Usage
33+
34+
### Identifying users
35+
36+
```python
37+
from knockapi import Knock
38+
client = Knock(api_key="sk_12345")
39+
40+
client.users.identify(id="jhammond", data={"name": "John Hammond", "email": "[email protected]"})
41+
```
42+
43+
## Retrieving users
44+
45+
```python
46+
from knockapi import Knock
47+
client = Knock(api_key="sk_12345")
48+
49+
client.users.get_user(id="jhammond")
50+
```
51+
52+
### Sending notifies
53+
54+
```python
55+
from knockapi import Knock
56+
client = Knock(api_key="sk_12345")
2957

30-
knock.api_key = "sk_12345"
58+
client.notify(
59+
name="dinosaurs-loose",
60+
actor="dnedry",
61+
recipients=["jhammond", "agrant", "imalcolm", "esattler"],
62+
data={
63+
"type": "trex",
64+
"priority": 1
65+
}
66+
)
3167
```

0 commit comments

Comments
 (0)