Closed cjw123ztt closed 4 years ago
uri=amqp://covprbbm:9exUT3KY19XpOfngiwkFVj99KOmM1xV5@fish.rmq.cloudamqp.com/covprbbm clientid=
exchange = "amq.fanout" routing_key ="NA" MAIL_TAG = "mailTag" MAIL_SUBJECT = "mailSubject" MAIL_SENDER = "mailSender" MAIL_RECEIVER = "mailReceiver" def on_message_callback(ch,method,properties,body): print("on_message_callback") print(properties) print(body) logging.info(body)
if name == 'main': connection = pika.BlockingConnection(pika.URLParameters(uri)) # channel = connection.channel() channel.queue_declare(clientid,False,False,True) channel.queue_bind(clientid,exchange,routing_key)
#hdrs = {u'مفتاح': u' قيمة', u'键': u'值', u'キー': u'値'}
hdrs={}
hdrs[MAIL_TAG] = "query lzBankuaiFuture"
hdrs[MAIL_SUBJECT] = "query lzBankuaiFuture"
hdrs[MAIL_SENDER] = clientid
properties = pika.BasicProperties(
app_id='example-publisher',
content_type='application/json',
headers=hdrs)
channel.basic_publish(exchange,routing_key,"python pc client hello",properties)
channel.basic_consume(clientid,on_message_callback)
channel.start_consuming()
channel.close()
connection.close()
https://www.cnpython.com/pypi/handout markdown转换成html,用浏览器xian
Task exception was never retrieved
future: <Task finished coro=<WebSocketProtocol13.write_message.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\websocket.py", line 1106, in wrapper raise WebSocketClosedError() tornado.websocket.WebSocketClosedError
Jupyter Notebook environment anaconda3 error https://www.jianshu.com/p/7d8ce818a923 C:\ProgramData\Anaconda3\Lib\site-packages\nb_conda\envmanager.py return { "environments": [root_env] + [get_info(env) for env in info['envs'] if env != root_env['dir']] }
Ensuring well-behaved connection with heartbeat and blocked-connection timeouts https://github.com/pika/pika/blob/master/docs/examples/heartbeat_and_blocked_timeouts.rst
1.(base) C:\Users\dfc>jupyter notebook --generate-config Writing default config to: C:\Users\dfc.jupyter\jupyter_notebook_config.py(改了之后不工作的) https://www.cnblogs.com/dj1232090/p/10648678.html 2.将目标最后的%USERPROFILE%替换成目标路径才可以
https://github.com/pika/pika https://pika.readthedocs.io/en/stable/ https://www.jianshu.com/p/7147c0070224 pip install pika Python 2.7 and 3.4+ are supported.