I am having trouble setting up a connection from a Python script to Azure Service Bus. A similar code in C# (on windows) is running fine.
from azure.servicebus import *
AZURE_SERVICEBUS_NAMESPACE='blablabla.servicebus.windows.net'
AZURE_SERVICEBUS_ISSUER='RootManageSharedAccessKey'
AZURE_SERVICEBUS_ACCESS_KEY='sdkfjlkewjrlwerjlewrjlewrjfjflsdkfjew3='
bus_service = ServiceBusService(service_namespace=AZURE_SERVICEBUS_NAMESPACE, account_key=AZURE_SERVICEBUS_ACCESS_KEY, issuer=AZURE_SERVICEBUS_ISSUER)
bus_service.create_queue('taskqueue')
This results in the following output:
Traceback (most recent call last): File "createqueue.py", line 9, in bus_service.create_queue('taskqueue') File "/usr/local/lib/python2.7/dist-packages/azure/servicebus/servicebusservice.py", line 143, in create_queue request.headers = self._update_service_bus_header(request) File "/usr/local/lib/python2.7/dist-packages/azure/servicebus/servicebusservice.py", line 860, in _update_service_bus_header ('Authorization', self._sign_service_bus_request(request))) File "/usr/local/lib/python2.7/dist-packages/azure/servicebus/servicebusservice.py", line 868, in _sign_service_bus_request self._get_token(request.host, request.path) + '"' File "/usr/local/lib/python2.7/dist-packages/azure/servicebus/servicebusservice.py", line 908, in _get_token resp = self._httpclient.perform_request(request) File "/usr/local/lib/python2.7/dist-packages/azure/http/httpclient.py", line 191, in perform_request self.send_request_headers(connection, request.headers) File "/usr/local/lib/python2.7/dist-packages/azure/http/httpclient.py", line 170, in send_request_headers connection.endheaders() File "/usr/lib/python2.7/httplib.py", line 958, in endheaders self._send_output(message_body) File "/usr/lib/python2.7/httplib.py", line 818, in _send_output self.send(msg) File "/usr/lib/python2.7/httplib.py", line 780, in send self.connect() File "/usr/lib/python2.7/httplib.py", line 1161, in connect self.timeout, self.source_address) File "/usr/lib/python2.7/socket.py", line 553, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno -2] Name or service not known
What is going wrong here?
Thanks