aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2013-04-12 18:24:01 +0200
committerThibaut Horel <thibaut.horel@gmail.com>2013-04-12 18:24:01 +0200
commit280069b993ba1121b3768003379ca0447aac7871 (patch)
tree130ae2e91751d975dc213401c6525df6d3ece918
parent098abd57a29e463064e93b8bbf2d46346821027b (diff)
downloadpython-pushover-280069b993ba1121b3768003379ca0447aac7871.tar.gz
Add an __all__ variable to limit the exported methods
-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):