Skip to content

Add BandcampRateLimitError exception for handling HTTP 429 (rate limit) responses from the Bandcamp API.#8

Merged
ALERTua merged 1 commit intomainfrom
429
Feb 1, 2026
Merged

Add BandcampRateLimitError exception for handling HTTP 429 (rate limit) responses from the Bandcamp API.#8
ALERTua merged 1 commit intomainfrom
429

Conversation

@ALERTua
Copy link
Copy Markdown
Owner

@ALERTua ALERTua commented Feb 1, 2026

Changes:

  • New BandcampRateLimitError exception with retry_after attribute
  • Parse Retry-After header with 30-second default fallback
  • Export exception publicly via init.py
  • Add tests for 429 handling on GET and POST requests
  • Document rate limiting with retry examples (manual and tenacity)

Approach: The library raises an exception rather than handling retries internally, following modern patterns used by httpx, aiohttp, and requests. This gives callers full control over retry logic.

- Add BandcampRateLimitError exception with retry_after attribute
- Handle 429 status code in _request method before raise_for_status()
- Parse Retry-After header with 30s default fallback for missing/invalid values
- Export exception in __init__.py and add to __all__
- Add comprehensive tests for rate limit scenarios (GET and POST)
- Document rate limiting with manual retry and tenacity examples
@ALERTua ALERTua merged commit 386707f into main Feb 1, 2026
6 checks passed
@ALERTua ALERTua deleted the 429 branch February 1, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant