Add support for new /api/v1/ping endpoint
This commit is contained in:
parent
70165413a5
commit
de2e804472
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
build/
|
||||||
|
kumisms.egg-info/
|
|
@ -40,6 +40,10 @@ class KumiSMS:
|
||||||
def check(self):
|
def check(self):
|
||||||
return bool(self.balance())
|
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={}):
|
def _request(self, url, data={}):
|
||||||
data.update({"key": self.key})
|
data.update({"key": self.key})
|
||||||
body = json.dumps(data).encode()
|
body = json.dumps(data).encode()
|
||||||
|
|
Loading…
Reference in a new issue