Skip to content

Add timeout parameter to download_video HTTP requests in video_describer.py #5

@chigwell

Description

@chigwell

User Story
As a software maintainer,
I want to add a timeout parameter to the download_video method's HTTP requests
so that the application avoids indefinite hangs when servers are unresponsive.

Background
The current download_video method in frame_story/video_describer.py uses requests.get(video_url) without a timeout. This creates reliability risks:

  • Unresponsive servers or unstable connections could freeze the process indefinitely.
  • No error recovery mechanism exists for stalled downloads, impacting user experience.
    The method is critical for fetching remote videos (e.g., get_video_descriptions uses it to retrieve URLs like http://example.com/video.mp4).

Acceptance Criteria

  • Modify download_video in video_describer.py to include a timeout parameter in the requests.get call (default: 10 seconds).
  • Update test_download_video in tests/test_video_describer.py to validate timeout behavior:
    • Mock a requests.get timeout and verify graceful error handling (e.g., exception raised/logged).
    • Confirm the timeout value is passed correctly in the HTTP request.
  • Ensure get_video_descriptions propagates timeout configurations to download_video if applicable.
  • Validate via integration testing:
    • Use a non-responsive test URL to confirm the request aborts after the specified timeout.
    • Verify the default timeout works as expected unless overridden.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions