Azure-Samples / iot-hub-python-get-started

This Python sample app is used by the getting started content to demonstrate how easy it is to create an IoTHub Instance on Azure portal, and register a new device for the IoTHub, then send a message from device (simulated device app) to cloud.
MIT License
28 stars 18 forks source link

deviveManager.py does not work #5

Open ajit-patra opened 5 years ago

ajit-patra commented 5 years ago

I ran from command prompt with my virtual environment (python 2.7.13). I am getting below error:

(ENV) C:\Work\RnD\Azure IoT>iot-hub-python-get-started-master\Python\service\deviceManager.py
Traceback (most recent call last):
  File "C:\Work\RnD\Azure IoT\iot-hub-python-get-started-master\Python\service\deviceManager.py", line 87, in <module>
    print(dm.listDeviceIds())
  File "C:\Work\RnD\Azure IoT\iot-hub-python-get-started-master\Python\service\deviceManager.py", line 70, in listDeviceIds
    r = requests.get(url, headers={'Content-Type': 'application/json', 'Authorization': sasToken})
  File "C:\Work\RnD\AZUREI~1\ENV\lib\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Work\RnD\AZUREI~1\ENV\lib\site-packages\requests\api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Work\RnD\AZUREI~1\ENV\lib\site-packages\requests\sessions.py", line 524, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Work\RnD\AZUREI~1\ENV\lib\site-packages\requests\sessions.py", line 637, in send
    r = adapter.send(request, **kwargs)
  File "C:\Work\RnD\AZUREI~1\ENV\lib\site-packages\requests\adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='XYZ.azure-devices.net', port=443): Max retries exceeded with url: /devices?top=1000&api-version=2016-02-03 (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)'),))

(ENV) C:\Work\RnD\Azure IoT>

I have used the connection string from my Azure IoT setup.