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 1 commit
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
Prev Previous commit
Next Next commit
add retry to v2/utils.py
  • Loading branch information
Kully committed Mar 8, 2018
commit caf3c62dbf8ad786ffd25007748287afcb6bf723
3 changes: 1 addition & 2 deletions plotly/api/v1/clientresp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import warnings

from requests.compat import json as _json
from retrying import retry

from plotly import config, utils, version
from plotly.api.v1.utils import request

from retrying import retry


@retry(wait_random_min=100, wait_random_max=1000, wait_exponential_max=10000,
stop_max_delay=30000)
Expand Down
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 @@ -48,6 +49,8 @@ def build_url(resource, id='', route=''):
return url


@retry(wait_random_min=100, wait_random_max=1000, wait_exponential_max=10000,
stop_max_delay=30000)
def validate_response(response):
"""
Raise a helpful PlotlyRequestError for failed requests.
Expand Down