Automate export of dashboards to folder

Comments

7 comments

  • Avatar
    Artem Yevtushenko

    Nice one Nathan!

    This could be great for version control! Export the PNG and Dash into the same folder to let users visually inspect the dash png before importing it.

    1
    Comment actions Permalink
  • Avatar
    Andrey Zhekov

    Hello!

    Thank you for the script. Could you please advise how to configure it for SSL connection? I got:

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "backup_dashboards.py", line 308, in <module>
    main()
    File "backup_dashboards.py", line 277, in main
    headers = authenticate(host, data_loaded['authentication'])
    File "backup_dashboards.py", line 29, in authenticate
    resp = requests.post('{}/api/v1/authentication/login'.format(host), data=data)
    File "/usr/lib/python3/dist-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
    File "/usr/lib/python3/dist-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
    File "/usr/lib/python3/dist-packages/requests/sessions.py", line 520, in request
    resp = self.send(prep, **send_kwargs)
    File "/usr/lib/python3/dist-packages/requests/sessions.py", line 630, in send
    r = adapter.send(request, **kwargs)
    File "/usr/lib/python3/dist-packages/requests/adapters.py", line 506, in send
    raise SSLError(e, request=request)
    requests.exceptions.SSLError: HTTPSConnectionPool(host='*****', port=443): Max retries exceeded with url: /api/v1/authentication/login (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))

    Tried to use the met hods here but stuck:

    https://stackoverflow.com/questions/27835619/urllib-and-ssl-certificate-verify-failed-error

    Best regards,

    Andrey

     

    0
    Comment actions Permalink
  • Avatar
    Nathan Giusti

    Hey Andrey Zhekov

    You can try the fixes here: https://medium.com/@moreless/how-to-fix-python-ssl-certificate-verify-failed-97772d9dd14c

    Or you can try using our new PythonSDK to write your own backup script. 

    https://support.sisense.com/hc/en-us/community/posts/360042115574-PySense-a-Python-SDK-for-Sisense

    Let me know how it goes. 

    Nathan

    0
    Comment actions Permalink
  • Avatar
    Andrey Zhekov

    Hello Nathan,

    The first fix didn't help. I found that Python 3.6+ has issue with TLS 1.2 SSL connections and TLS v1.2 is now enforced in Sisense v.8.1.3 which is our current server version.

    https://github.com/docker-library/python/issues/429

    We will try PythonSDK soon.

    Best regards,

    Andrey

    0
    Comment actions Permalink
  • Avatar
    Joe Chafin

    Hi Andrey, 

    To get around the TLS issue I installed certifi -- https://pypi.org/project/certifi/. If that still doesn't work you can append your root CA from the certificate to the certifi cacerts.pem file (run certifi.where() to check the location).

    0
    Comment actions Permalink
  • Avatar
    Ru Bell

    Thanks for the script. Could you please advise for error below:

    File "C:\Users\rabell\Desktop\SisenseBackUp\backup_dashboards.py", line 302, in <module>
    main()
    File "C:\Users\rabell\Desktop\SisenseBackUp\backup_dashboards.py", line 271, in main
    headers = authenticate(host, data_loaded['authentication'])
    File "C:\Users\rabell\Desktop\SisenseBackUp\backup_dashboards.py", line 22, in authenticate
    data = {'username': authentication_params['username'], 'password': authentication_params['password']}
    TypeError: string indices must be integers

    0
    Comment actions Permalink
  • Avatar
    Nathan Giusti

    Hey Ru, 

     

    I am no longer supporting this script. 

     

    Instead I recommend using PySense

    Community Article: https://support.sisense.com/hc/en-us/community/posts/360042115574-PySense-a-Python-SDK-for-Sisense

    GitHub: https://github.com/nathangiusti/PySense/

     

    You can use this to get all of your dashboards and export them to dash, png, or csv. See the documentation and training for details. 

     

    Cheers, 

    Nathan

     

    0
    Comment actions Permalink

Please sign in to leave a comment.