|
8 | 8 | from plotly.api.utils import basic_auth
|
9 | 9 |
|
10 | 10 |
|
| 11 | +HTTP_ERROR_MESSAGE = ( |
| 12 | + """Your plotly_domain and plotly_api_domain must be HTTPS and not HTTP.\n |
| 13 | + If you are not using On-Prem then run the following code to ensure your |
| 14 | + plotly_domain and plotly_api_domain start with 'https': |
| 15 | +
|
| 16 | + ``` |
| 17 | + import plotly |
| 18 | + plotly.tools.set_config_file( |
| 19 | + plotly_domain='https://plot.ly', |
| 20 | + plotly_api_domain='https://api.plot.ly' |
| 21 | + ) |
| 22 | + ``` |
| 23 | +
|
| 24 | + If you are using On-Prem then you will need to use your company's |
| 25 | + domain and api_domain urls: |
| 26 | +
|
| 27 | + ``` |
| 28 | + import plotly |
| 29 | + plotly.tools.set_config_file( |
| 30 | + plotly_domain='https://plotly.your-company.com', |
| 31 | + plotly_api_domain='https://plotly.your-company.com' |
| 32 | + ) |
| 33 | + ``` |
| 34 | +
|
| 35 | + Make sure to replace "your-company.com" with the URL of your Plotly On-Premise server. |
| 36 | +
|
| 37 | + See https://plot.ly/python/getting-started/#special-instructions-for-plotly-onpremise-users |
| 38 | + for more tips for getting started with Plotly.""" |
| 39 | +) |
| 40 | + |
| 41 | + |
11 | 42 | def make_params(**kwargs):
|
12 | 43 | """
|
13 | 44 | Helper to create a params dict, skipping undefined entries.
|
@@ -76,6 +107,10 @@ def validate_response(response):
|
76 | 107 | if not message:
|
77 | 108 | message = content if content else 'No Content'
|
78 | 109 |
|
| 110 | + if not response.history[0].url.startswith('https:'): |
| 111 | + raise exceptions.PlotlyRequestError(HTTP_ERROR_MESSAGE, |
| 112 | + status_code, content) |
| 113 | + |
79 | 114 | raise exceptions.PlotlyRequestError(message, status_code, content)
|
80 | 115 |
|
81 | 116 |
|
|
0 commit comments