Add support for new /api/v1/ping endpoint

This commit is contained in:
Kumi 2023-04-14 15:21:45 +00:00
parent 70165413a5
commit de2e804472
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 6 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
build/
kumisms.egg-info/

View file

@ -40,6 +40,10 @@ class KumiSMS:
def check(self):
return bool(self.balance())
def ping(self):
endpoint = urllib.parse.urljoin(self.endpoint, "ping/")
return self._request(endpoint)["status"] == "success"
def _request(self, url, data={}):
data.update({"key": self.key})
body = json.dumps(data).encode()