Py.image.get() returns an error

I’m using py.image.get() to get image bytes and I noticed that it works for the first 100 graphs or so and after that it stops working by returning a following error:

raise exceptions.PlotlyError(return_data[‘error’])
KeyError: ‘error’

Since this method is calling an API I assume the error is related to some kind of API limit. However, it is not the defined (50 per day or 30 per hour) API limit because the method works beyond this limit.

Is there any limit using py.image.get() method? If yes, what is the limit?


Hi there,

So I tried that looping that py.image.get() more than 100 times and I got no errors. I want to rule out whether or not this is some sort of API limit for you.

So what I recommend is the following course of action. Try doing that thing you did that caused the error before, then if you receive the error again, execute the one liner: py.image.get(your_data) and see if you get the same error (I am assuming you are using the ipython notebook).

Simultaneously, you can explain to me exactly how you are running py.image.get() or just send me a snippet of your code so I can have a look.


Hi Adam,

So I found that the limit is actually 250. More importantly - after I start getting the error I change API user and I can keep going again without the error. Looks like his is some kind of undocumented API limit.

I’m not using ipython notebook. I’m getting image bytes and saving the png image on a remote server. Here is my basic code:

import plotly.plotly as py
from plotly.graph_objs import *
import as tls
tls.set_credentials_file(username=‘myuser’, api_key=‘mykey’)

fig = Figure(data=data, layout=layout)
img = py.image.get(fig)

Hi there,
We’ve recently updated our plans page to reflect this limit, please note the API call limits are subject to change.

Thanks Chelsea. Makes sense now. Great that you increases Community API limit.

Would be great if you guys introduce a plan which allows higher number of API calls just for saving graph images offline.

Thanks for your help!