Skip to content

Missing Exception in fetch_jobs_from_api #30

Open

Description

@beetle-ai

ISSUE_NUMBER: GH-26

Description

The fetch_jobs_from_api function in linkedin.py prints an error message if the request fails, but it doesn't raise an exception.
File: repositories/jobflowapi/function/crawler/job_portals/linkedin.py
Line: 40
Severity: high

Current Behavior

Function prints an error message but continues execution when the API request fails.

Expected Behavior

Function should raise an exception to halt execution and prevent further errors when the API request fails.

Suggested Fix

Raise an exception in the else block when the API request fails.

Code Context

if response.status_code == 200:
return BeautifulSoup(response.text, 'html.parser')
else:
print(f"Failed to fetch jobs at start={start}: {response.status_code}, error: {response}")
return None

Additional Notes

This can lead to unexpected behavior and makes debugging difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions