Azure Event Hubs - REST API Authentication

Viewed 920

I have a Python program that generates streaming data. Each piece of data is stored as a variable called message.

Since Event Hubs does not offer a Python SDK, I've opted to use their REST API. I've attempted to push the data to my Event Hub instance as a part of my Python program that generates data as follows:

r = requests.post("https://{Instance name}.servicebus.windows.net/{Path}/messages", message)

print(r.status_code, r.reason)

Upon executing this code, I receive a 401 Unauthorized response.

After running into this issue, I used this tutorial to try and create a shared access signature. Upon using curl to confirm that my generated token worked, I received a HTTP/1.1 401 40103: Invalid authorization token signature response.

Is there a better way to send the data while still generating it in Python? A better way to create a shared access signature?

1 Answers
Related