Skip to content

fix for rate limit response bug #262

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

Merged
merged 1 commit into from
Aug 15, 2025
Merged
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
116 changes: 0 additions & 116 deletions PAGINATION_FIX_README.md

This file was deleted.

6 changes: 5 additions & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ Contributing Code
.. code-block:: bash

python3 -m venv venv

# On Mac/Linux
source venv/bin/activate
# On Windows
venv\Scripts\activate.bat

4. Install poetry.

Expand Down Expand Up @@ -75,7 +79,7 @@ Contributing Code
8. If you running the test suite locally, ensure your code passes all of the default tests. Use the ``test`` target and ensure all tests execute successfully.

.. code-block:: bash

# see below for more information on running the test suite locally
make tests

9. Commit your changes.
Expand Down
18 changes: 17 additions & 1 deletion src/webexpythonsdk/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,28 @@ def __init__(self, response):
assert isinstance(response, requests.Response)

# Extended exception attributes
self.retry_after = max(1, int(response.headers.get("Retry-After", 15)))
try:
retry_after = int(response.headers.get("Retry-After", 15))
except (ValueError, TypeError):
# Handle malformed Retry-After headers gracefully
# Log a warning for debugging purposes
import logging
logger = logging.getLogger(__name__)
logger.warning(
f"Malformed Retry-After header received: {response.headers.get('Retry-After')}. "
"Defaulting to 15 seconds."
)
retry_after = 15

self.retry_after = max(1, retry_after)
"""The `Retry-After` time period (in seconds) provided by Webex.

Defaults to 15 seconds if the response `Retry-After` header isn't
present in the response headers, and defaults to a minimum wait time of
1 second if Webex returns a `Retry-After` header of 0 seconds.

Note: If the Retry-After header contains malformed values (non-integer strings,
etc.), it will default to 15 seconds and log a warning.
"""

super(RateLimitError, self).__init__(response)
Expand Down
Loading