# coding:utf-8
import pika
username = 'feng'
password = 'nihao'
host = '192.168.1.144'
credentials = pika.PlainCredentials(username, password)
connection = pika.BlockingConnection(pika.ConnectionParameters(host=host, credentials=credentials, port=5672))
channel = connection.channel()
channel.queue_declare(queue='trans_queue',auto_delete=True)
channel.basic_publish(exchange='',
routing_key='hello',
body='Hello World!')
print "[x] Sent 'Hello World!'"
connection.close()
手机扫一扫
移动阅读更方便
你可能感兴趣的文章