Fetch and return `response` from the `url`
(url)
| 391 | |
| 392 | |
| 393 | def fetch_response(url): |
| 394 | """ |
| 395 | Fetch and return `response` from the `url` |
| 396 | """ |
| 397 | try: |
| 398 | response = requests.get(url) |
| 399 | if response.status_code == HTTPStatus.OK: |
| 400 | return response |
| 401 | raise Exception( |
| 402 | f"Failed to fetch data from {url!r} with status code: {response.status_code!r}" |
| 403 | ) |
| 404 | except Exception as e: |
| 405 | logger.error(f"Error fetching data from {url!r}: {e}") |
| 406 | return None |
| 407 | |
| 408 | |
| 409 | # This should be a method on PackageURL |
no test coverage detected