Skip to content

Commit 9f5c3e2

Browse files
committed
refactor: adjust for server breaking change
1 parent 6ef125e commit 9f5c3e2

File tree

4 files changed

+14
-29
lines changed

4 files changed

+14
-29
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ pip install znotify
1111
## Usage
1212

1313
```python
14-
import znotify
14+
from znotify import Client
1515

16-
client = znotify.Client.create("user_id")
16+
client = Client.create("user_id")
1717
client.send("Hello World")
1818
```
1919

poetry.lock

Lines changed: 9 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "znotify"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
description = "sdk for notify"
55
authors = ["Zxilly <[email protected]>"]
66
license = "GPL-3.0"

znotify/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def create(user_id, endpoint=None):
1717

1818
def check(self):
1919
resp = requests.get(f"{self.endpoint}/check", params={"user_id": self.user_id})
20-
if not resp.json():
20+
if not resp.json()["body"]:
2121
raise Exception("User ID not valid")
2222

2323
def send(self, content, title=None, long=None):
@@ -38,4 +38,4 @@ def send(self, content, title=None, long=None):
3838
resp = requests.post(f"{self.endpoint}/{self.user_id}/send", data=data)
3939
except ConnectionError as e:
4040
raise Exception("Connection error") from e
41-
return resp.json()
41+
return resp.json()["body"]

0 commit comments

Comments
 (0)