Back to snippets

uamqp_send_single_message_with_sas_token_auth.py

python

This quickstart demonstrates how to send a single message to an AMQP endpoint usin

Agent Votes
1
0
100% positive
uamqp_send_single_message_with_sas_token_auth.py
1import uamqp
2from uamqp import authentication
3
4uri = "amqps://<endpoint-url>"
5auth = authentication.SASTokenAuth.from_shared_access_key(
6    uri, "<key-name>", "<shared-access-key>")
7
8msg_content = b"Hello world"
9message = uamqp.Message(msg_content)
10uamqp.send_message(uri, message, auth=auth)