Skip to content

Add retry logic for Pexels/Pixabay API calls#10

Open
Asad-Ismail wants to merge 1 commit intomainfrom
add-api-retry
Open

Add retry logic for Pexels/Pixabay API calls#10
Asad-Ismail wants to merge 1 commit intomainfrom
add-api-retry

Conversation

@Asad-Ismail
Copy link
Copy Markdown
Owner

Summary

  • Add tenacity-based retry (3 attempts, exponential backoff) to search_videos_pexels, search_videos_pixabay, and video download requests
  • Retries only on ConnectionError and Timeout -- non-transient errors still fail fast
  • Extract _download_video_content helper to keep save_video unchanged otherwise
  • Pin tenacity>=8.2.0 in requirements.txt

Test plan

  • Verify normal Pexels/Pixabay search still works end-to-end
  • Simulate a transient timeout (e.g. mock requests.get to raise Timeout once) and confirm retry succeeds
  • Confirm non-retryable errors (e.g. 403) still propagate immediately

Use tenacity to retry on ConnectionError and Timeout for search and
download requests. Extracts video download into a small helper so
it can be decorated independently.
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