May-12-2017, 07:10 PM
Hi,
I'm new to Python and I'm trying to run a their script. It works a treat, however, if I use it too much, I get an error saying I've breached the API limit.
Is there a way I can somehow capture that text response? I'll include the last bit of my script. The error gets generated at the very last line.
Many thanks,
J
I'm new to Python and I'm trying to run a their script. It works a treat, however, if I use it too much, I get an error saying I've breached the API limit.
Is there a way I can somehow capture that text response? I'll include the last bit of my script. The error gets generated at the very last line.
layout = go.Layout( title='BigScenario - Average', xaxis=dict( title='Application Version', titlefont=dict( family='Times New Roman, monospace', size=18 ) ), yaxis=dict( title='Seconds', titlefont=dict( family='Times New Roman, monospace', size=18 ) ), hovermode='closest' ) fig = go.Figure(data=data, layout=layout) plot_url = py.plot(fig, filename='09052017230558')So when I run it, I get the following returned in the console:
Error: plot_url = py.plot(fig, filename='09052017230558')
File "C:\Users\John\AppData\Local\Programs\Python\Python36\lib\site-packages\plotly\plotly\plotly.py", line 227, in plot
response = v1.clientresp(data, **plot_options)
File "C:\Users\John\AppData\Local\Programs\Python\Python36\lib\site-packages\plotly\api\v1\clientresp.py", line 35, in clientresp
response = request('post', url, data=payload)
File "C:\Users\John\AppData\Local\Programs\Python\Python36\lib\site-packages\plotly\api\v1\utils.py", line 86, in request
validate_response(response)
File "C:\Users\John\AppData\Local\Programs\Python\Python36\lib\site-packages\plotly\api\v1\utils.py", line 38, in validate_response
raise exceptions.PlotlyRequestError(message, status_code, content)
plotly.exceptions.PlotlyRequestError: Hey there! You've hit one of our API request limits.
To get unlimited API calls(10,000/day), please upgrade to a paid plan.
Thanks for using Plotly! Happy Plotting!
I'd like to capture and check for a substring in that error if it occurs. Is this possible?Many thanks,
J