updates list for new rest result
- list is now a json object which contains "messages" which is a JSON Array list
This commit is contained in:
parent
be09c04987
commit
3d3633592a
17
main.py
17
main.py
@ -7,6 +7,7 @@ import requests
|
||||
import base64
|
||||
import re
|
||||
|
||||
|
||||
SENDER_LENGTH = 4
|
||||
PASSWORD_LENGTH = 8
|
||||
|
||||
@ -109,6 +110,10 @@ class Bump:
|
||||
password = self.get_password()
|
||||
return password_decrypt(data, password).decode()
|
||||
|
||||
def push_fake(self, data):
|
||||
print(self.encrypt(data))
|
||||
|
||||
|
||||
def push(self, data):
|
||||
url = self.URL + "push"
|
||||
params = {
|
||||
@ -121,8 +126,8 @@ class Bump:
|
||||
print(r.json())
|
||||
|
||||
|
||||
def peak(self):
|
||||
return self.get_post("peak")
|
||||
def peek(self):
|
||||
return self.get_post("peek")
|
||||
|
||||
def pop(self):
|
||||
return self.get_post("pop")
|
||||
@ -148,10 +153,11 @@ class Bump:
|
||||
|
||||
messages = requests.post(url, params).json()
|
||||
|
||||
if messages == {} or messages == None or messages == []:
|
||||
if(messages == {} or messages == None or
|
||||
"messages" in messages and messages["messages"] == []):
|
||||
return [{}]
|
||||
elif type(messages) == list:
|
||||
for message in messages:
|
||||
elif "messages" in messages:
|
||||
for message in messages.get("messages"):
|
||||
message['data'] = self.decrypt(message.get('data'))
|
||||
|
||||
return messages
|
||||
@ -186,3 +192,4 @@ class Bump:
|
||||
|
||||
if __name__ == '__main__':
|
||||
b = Bump()
|
||||
b.decrypt("M1dEAxKZ5HUHCJoRkgGOvAABhqCAAAAAAGG2eKTSlKXWLDQx5B_wssZsNwsanzQID2UyUm4KKuKYKgfwH5MG2N-qzt6K4mg3pfZmWPaiDB9PiqlX236k6zo9Yvvq")
|
||||
|
Loading…
Reference in New Issue
Block a user