rrr
阅读原文时间:2023年07月08日阅读:1

# 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()

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章