adds firebase handler, extracts set functions
This commit is contained in:
parent
3d3633592a
commit
7f3ffbc906
23
main.py
23
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user