Created
March 26, 2025 18:38
-
-
Save VinayakTiwari1103/68facb0ca277f5556c20c35afa4b40ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| class OSSFuzzResults: | |
| """A class for accessing OSS-Fuzz historical results and crash reports.""" | |
| BASE_URL = "https://oss-fuzz.com/api/v1/reports" | |
| @staticmethod | |
| def get_crash_reports(project_name, start_date, end_date): | |
| """ | |
| Fetches crash reports for a given OSS-Fuzz project within a specified date range. | |
| Args: | |
| project_name (str): The OSS-Fuzz project name. | |
| start_date (str): The start date (YYYY-MM-DD). | |
| end_date (str): The end date (YYYY-MM-DD). | |
| Returns: | |
| dict: A JSON object containing crash report details. | |
| """ | |
| params = {"project": project_name, "start_date": start_date, "end_date": end_date} | |
| response = requests.get(OSSFuzzResults.BASE_URL, params=params) | |
| if response.status_code == 200: | |
| return response.json() | |
| else: | |
| return {"error": f"Failed to fetch reports for {project_name}. Status: {response.status_code}"} | |
| # Usage Example | |
| crash_reports = OSSFuzzResults.get_crash_reports("example_project", "2024-01-01", "2024-03-01") | |
| print(crash_reports) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment