Skip to content

Retry requests for Python API #964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions optional-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ scipy
jupyter
ipykernel

## deps for _county_choropleth.py figure factory
## deps for _county_choropleth.py figure factory ##
pyshp
geopandas
shapely
shapely
3 changes: 3 additions & 0 deletions plotly/api/v2/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import requests
from requests.compat import json as _json
from requests.exceptions import RequestException
from retrying import retry

from plotly import config, exceptions, version, utils
from plotly.api.utils import basic_auth
Expand Down Expand Up @@ -111,6 +112,8 @@ def get_headers():
return headers


@retry(wait_random_min=100, wait_random_max=1000, wait_exponential_max=10000,
stop_max_delay=30000)
def request(method, url, **kwargs):
"""
Central place to make any api v2 api request.
Expand Down
80 changes: 40 additions & 40 deletions plotly/graph_objs/graph_objs.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,15 +873,16 @@ class Bar(PlotlyDict):
"""
Valid attributes for 'bar' at path [] under parents ():

['bardir', 'base', 'basesrc', 'constraintext', 'customdata',
'customdatasrc', 'dx', 'dy', 'error_x', 'error_y', 'hoverinfo',
'hoverinfosrc', 'hoverlabel', 'hovertext', 'hovertextsrc', 'ids',
'idssrc', 'insidetextfont', 'legendgroup', 'marker', 'name', 'offset',
'offsetsrc', 'opacity', 'orientation', 'outsidetextfont', 'r', 'rsrc',
'selected', 'selectedpoints', 'showlegend', 'stream', 't', 'text',
'textfont', 'textposition', 'textpositionsrc', 'textsrc', 'tsrc',
'type', 'uid', 'unselected', 'visible', 'width', 'widthsrc', 'x', 'x0',
'xaxis', 'xcalendar', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'ysrc']
['bardir', 'base', 'basesrc', 'cliponaxis', 'constraintext',
'customdata', 'customdatasrc', 'dx', 'dy', 'error_x', 'error_y',
'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertext', 'hovertextsrc',
'ids', 'idssrc', 'insidetextfont', 'legendgroup', 'marker', 'name',
'offset', 'offsetsrc', 'opacity', 'orientation', 'outsidetextfont',
'r', 'rsrc', 'selected', 'selectedpoints', 'showlegend', 'stream', 't',
'text', 'textfont', 'textposition', 'textpositionsrc', 'textsrc',
'tsrc', 'type', 'uid', 'unselected', 'visible', 'width', 'widthsrc',
'x', 'x0', 'xaxis', 'xcalendar', 'xsrc', 'y', 'y0', 'yaxis',
'ycalendar', 'ysrc']

Run `<bar-object>.help('attribute')` on any of the above.
'<bar-object>' is the object at []
Expand Down Expand Up @@ -1132,9 +1133,8 @@ class ErrorY(PlotlyDict):
Valid attributes for 'error_y' at path [] under parents ():

['array', 'arrayminus', 'arrayminussrc', 'arraysrc', 'color',
'copy_ystyle', 'copy_zstyle', 'opacity', 'symmetric', 'thickness',
'traceref', 'tracerefminus', 'type', 'value', 'valueminus', 'visible',
'width']
'copy_zstyle', 'opacity', 'symmetric', 'thickness', 'traceref',
'tracerefminus', 'type', 'value', 'valueminus', 'visible', 'width']

Run `<error_y-object>.help('attribute')` on any of the above.
'<error_y-object>' is the object at []
Expand All @@ -1148,9 +1148,8 @@ class ErrorZ(PlotlyDict):
Valid attributes for 'error_z' at path [] under parents ():

['array', 'arrayminus', 'arrayminussrc', 'arraysrc', 'color',
'copy_ystyle', 'copy_zstyle', 'opacity', 'symmetric', 'thickness',
'traceref', 'tracerefminus', 'type', 'value', 'valueminus', 'visible',
'width']
'opacity', 'symmetric', 'thickness', 'traceref', 'tracerefminus',
'type', 'value', 'valueminus', 'visible', 'width']

Run `<error_z-object>.help('attribute')` on any of the above.
'<error_z-object>' is the object at []
Expand Down Expand Up @@ -1459,7 +1458,7 @@ class Layout(PlotlyDict):
['angularaxis', 'annotations', 'autosize', 'bargap', 'bargroupgap',
'barmode', 'barnorm', 'boxgap', 'boxgroupgap', 'boxmode', 'calendar',
'colorway', 'datarevision', 'direction', 'dragmode', 'font', 'geo',
'height', 'hiddenlabels', 'hiddenlabelssrc', 'hidesources',
'grid', 'height', 'hiddenlabels', 'hiddenlabelssrc', 'hidesources',
'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend',
'mapbox', 'margin', 'orientation', 'paper_bgcolor', 'plot_bgcolor',
'polar', 'radialaxis', 'scene', 'separators', 'shapes', 'showlegend',
Expand Down Expand Up @@ -1934,18 +1933,19 @@ class XAxis(PlotlyDict):
"""
Valid attributes for 'xaxis' at path [] under parents ():

['anchor', 'autorange', 'autotick', 'backgroundcolor', 'calendar',
'categoryarray', 'categoryarraysrc', 'categoryorder', 'color',
'constrain', 'constraintoward', 'domain', 'dtick', 'exponentformat',
'fixedrange', 'gridcolor', 'gridwidth', 'hoverformat', 'layer',
'linecolor', 'linewidth', 'mirror', 'nticks', 'overlaying', 'position',
'range', 'rangemode', 'rangeselector', 'rangeslider', 'scaleanchor',
'scaleratio', 'separatethousands', 'showaxeslabels', 'showbackground',
'showexponent', 'showgrid', 'showline', 'showspikes', 'showticklabels',
'showtickprefix', 'showticksuffix', 'side', 'spikecolor', 'spikedash',
'spikemode', 'spikesides', 'spikesnap', 'spikethickness', 'tick0',
'tickangle', 'tickcolor', 'tickfont', 'tickformat', 'tickformatstops',
'ticklen', 'tickmode', 'tickprefix', 'ticks', 'ticksuffix', 'ticktext',
['anchor', 'automargin', 'autorange', 'autotick', 'backgroundcolor',
'calendar', 'categoryarray', 'categoryarraysrc', 'categoryorder',
'color', 'constrain', 'constraintoward', 'domain', 'dtick',
'exponentformat', 'fixedrange', 'gridcolor', 'gridwidth',
'hoverformat', 'layer', 'linecolor', 'linewidth', 'mirror', 'nticks',
'overlaying', 'position', 'range', 'rangemode', 'rangeselector',
'rangeslider', 'scaleanchor', 'scaleratio', 'separatethousands',
'showaxeslabels', 'showbackground', 'showexponent', 'showgrid',
'showline', 'showspikes', 'showticklabels', 'showtickprefix',
'showticksuffix', 'side', 'spikecolor', 'spikedash', 'spikemode',
'spikesides', 'spikesnap', 'spikethickness', 'tick0', 'tickangle',
'tickcolor', 'tickfont', 'tickformat', 'tickformatstops', 'ticklen',
'tickmode', 'tickprefix', 'ticks', 'ticksuffix', 'ticktext',
'ticktextsrc', 'tickvals', 'tickvalssrc', 'tickwidth', 'title',
'titlefont', 'type', 'visible', 'zeroline', 'zerolinecolor',
'zerolinewidth']
Expand Down Expand Up @@ -1974,18 +1974,18 @@ class YAxis(PlotlyDict):
"""
Valid attributes for 'yaxis' at path [] under parents ():

['anchor', 'autorange', 'autotick', 'backgroundcolor', 'calendar',
'categoryarray', 'categoryarraysrc', 'categoryorder', 'color',
'constrain', 'constraintoward', 'domain', 'dtick', 'exponentformat',
'fixedrange', 'gridcolor', 'gridwidth', 'hoverformat', 'layer',
'linecolor', 'linewidth', 'mirror', 'nticks', 'overlaying', 'position',
'range', 'rangemode', 'scaleanchor', 'scaleratio', 'separatethousands',
'showaxeslabels', 'showbackground', 'showexponent', 'showgrid',
'showline', 'showspikes', 'showticklabels', 'showtickprefix',
'showticksuffix', 'side', 'spikecolor', 'spikedash', 'spikemode',
'spikesides', 'spikesnap', 'spikethickness', 'tick0', 'tickangle',
'tickcolor', 'tickfont', 'tickformat', 'tickformatstops', 'ticklen',
'tickmode', 'tickprefix', 'ticks', 'ticksuffix', 'ticktext',
['anchor', 'automargin', 'autorange', 'autotick', 'backgroundcolor',
'calendar', 'categoryarray', 'categoryarraysrc', 'categoryorder',
'color', 'constrain', 'constraintoward', 'domain', 'dtick',
'exponentformat', 'fixedrange', 'gridcolor', 'gridwidth',
'hoverformat', 'layer', 'linecolor', 'linewidth', 'mirror', 'nticks',
'overlaying', 'position', 'range', 'rangemode', 'scaleanchor',
'scaleratio', 'separatethousands', 'showaxeslabels', 'showbackground',
'showexponent', 'showgrid', 'showline', 'showspikes', 'showticklabels',
'showtickprefix', 'showticksuffix', 'side', 'spikecolor', 'spikedash',
'spikemode', 'spikesides', 'spikesnap', 'spikethickness', 'tick0',
'tickangle', 'tickcolor', 'tickfont', 'tickformat', 'tickformatstops',
'ticklen', 'tickmode', 'tickprefix', 'ticks', 'ticksuffix', 'ticktext',
'ticktextsrc', 'tickvals', 'tickvalssrc', 'tickwidth', 'title',
'titlefont', 'type', 'visible', 'zeroline', 'zerolinecolor',
'zerolinewidth']
Expand Down
Loading