aboutsummaryrefslogtreecommitdiffstats
path: root/pushover.py
diff options
context:
space:
mode:
Diffstat (limited to 'pushover.py')
-rw-r--r--pushover.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/pushover.py b/pushover.py
index 7ec6af2..214c2a2 100644
--- a/pushover.py
+++ b/pushover.py
@@ -1,6 +1,7 @@
import requests
import time
+__all__ = ["init", "get_sounds", "Client", "InitError", "RequestError"]
BASE_URL = "https://api.pushover.net/1/"
MESSAGE_URL = BASE_URL + "messages.json"
USER_URL = BASE_URL + "users/validate.json"
@@ -12,14 +13,16 @@ TOKEN = None
def get_sounds():
global SOUNDS
- request = Request("get", SOUND_URL, {})
- SOUNDS = request.answer["sounds"]
+ if not SOUNDS:
+ request = Request("get", SOUND_URL, {})
+ SOUNDS = request.answer["sounds"]
+ return SOUNDS
def init(token, sound=False):
global TOKEN
TOKEN = token
if sound:
- get_sounds()
+ return get_sounds()
class InitError(Exception):