How can I access 'body' within this python function from an external script? -


software: python 2.7 using pika:

i need able access 'body' within function external script - preferred method of doing this?

def callback(ch, method, properties, body): print(" [x] received %r" % body)  channel.basic_consume(callback,                   queue=queuename,                   no_ack=true)  print(' [*] waiting messages. exit press ctrl+c') channel.start_consuming() 

i able import body str variable , run split on when import script containing above code, script seems run code block , doesn't allow me assign body shown below...

string_body = str(body) 

or run split on (shown below)

body_vars = string_body.split(';') 

can point me in right direction?

i can split , assign body variables within callback function , don't seem able access these external script...

i have been driving myself crazy trying work out how appreciated...


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -