Skip to content

Commit

Permalink
use json to decode rabbitmq message body
Browse files Browse the repository at this point in the history
  • Loading branch information
newtondotcom committed Jan 3, 2024
1 parent 0311f5b commit 6ea86ef
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions worker/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from s3 import *
from emojis import *
from treat import *
import json

print(' Connecting to server ...')

Expand All @@ -21,15 +22,22 @@

print(' Waiting for messages...')

#channel.basic_publish(exchange='', routing_key='task_queue', body='Hello World!')

def callback(ch, method, properties, body):
bodyjson = json.loads(body)

## Parameters
file_bucket_name = "videos"
file_name = "test.mp4"
emoji = True
lsilence = True
file_bucket_name = bodyjson['file_bucket_name']
file_name = bodyjson['file_name']
emoji = bodyjson['emoji']
lsilence = bodyjson['silence']

#email = bodyjson['email']

## Default parameters
#file_bucket_name = "videos"
#file_name = "test.mp4"
#emoji = True
#lsilence = True

#Download file from S3
local_file_path = "temp/"+file_name
Expand Down

0 comments on commit 6ea86ef

Please sign in to comment.