diff --git a/main.py b/main.py index b2cd6db..908d5ef 100644 --- a/main.py +++ b/main.py @@ -115,15 +115,17 @@ class Bump: def push(self, data): - url = self.URL + "push" params = { 'sender': self.get_sender(), 'data': self.encrypt(data) } + return self.set_post("push", params) - print(url) - r = requests.post(url, params) - print(r.json()) + def firebase(self): + params = { + 'token': "HIJKLMNOPQRSTUVWXYZ" + } + return self.set_post("firebase", params) def peek(self): @@ -138,9 +140,22 @@ class Bump: } return self.get_post("list", params) + def clear(self): return self.get_post("clear") + def set_post(self, mechanism, add_params = None): + url = self.URL + mechanism + params = { + 'sender': self.get_sender(), + } + + if add_params != None: + params.update(add_params) + + messages = requests.post(url, params).json() + print(messages) + def get_post(self, mechanism, add_params = None): url = self.URL + mechanism