notification manager
This commit is contained in:
@@ -28,7 +28,10 @@ class MessagingSupport(BaseCommand):
|
||||
raise NotImplementedError
|
||||
|
||||
def consume(self, ch, method, properties, body):
|
||||
self.process(json.loads(body.decode('utf-8')))
|
||||
data = json.loads(body.decode('utf-8'))
|
||||
print(f"Got {data}, processing...")
|
||||
self.process(data)
|
||||
print("Process finished successfully")
|
||||
|
||||
def handle(self, *args, **options):
|
||||
if self.queue_name is None:
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import datetime
|
||||
import os
|
||||
from random import choice
|
||||
|
||||
from requests import get, post
|
||||
@@ -9,19 +10,19 @@ from Sprint import settings
|
||||
def write_bytes(data: bytes):
|
||||
url = settings.FS_HOST + ":" + str(settings.FS_PORT) + "/upload_file"
|
||||
print(url)
|
||||
return post(url, data=data).json()["id"]
|
||||
return post(url, data=data, headers={'token': os.getenv('FS_TOKEN')}).json()["id"]
|
||||
|
||||
|
||||
def get_bytes(num: int) -> bytes:
|
||||
url = settings.FS_HOST + ":" + str(settings.FS_PORT) + "/get_file?id=" + str(num)
|
||||
print(url)
|
||||
return get(url).content
|
||||
return get(url, headers={'token': os.getenv('FS_TOKEN')}).content
|
||||
|
||||
|
||||
def delete_file(num: int):
|
||||
url = settings.FS_HOST + ":" + str(settings.FS_PORT) + "/delete_file?id=" + str(num)
|
||||
print(url)
|
||||
post(url)
|
||||
post(url, headers={'token': os.getenv('FS_TOKEN')})
|
||||
|
||||
|
||||
def generate_token():
|
||||
|
Reference in New Issue
Block a user