# Datasets ## List datasets `radar.datasets.list(DatasetListParams**kwargs) -> DatasetListResponse` **get** `/radar/datasets` Retrieves a list of datasets. ### Parameters - `dataset_type: Optional[Literal["RANKING_BUCKET", "REPORT"]]` Filters results by dataset type. - `"RANKING_BUCKET"` - `"REPORT"` - `date: Optional[Union[null, null]]` Filters results by the specified date. - `format: Optional[Literal["JSON", "CSV"]]` Format in which results will be returned. - `"JSON"` - `"CSV"` - `limit: Optional[int]` Limits the number of objects returned in the response. - `offset: Optional[int]` Skips the specified number of objects before fetching the results. ### Returns - `class DatasetListResponse: …` - `datasets: List[Dataset]` - `id: int` - `description: str` - `meta: object` - `tags: List[str]` - `title: str` - `type: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) datasets = client.radar.datasets.list() print(datasets.datasets) ``` #### Response ```json { "result": { "datasets": [ { "id": 3, "description": "This dataset contains a list of the op 20000 domains globally", "meta": {}, "tags": [ "global" ], "title": "Top bucket 20000 domains", "type": "RANKING_BUCKET" } ] }, "success": true } ``` ## Get dataset CSV stream `radar.datasets.get(stralias) -> DatasetGetResponse` **get** `/radar/datasets/{alias}` Retrieves the CSV content of a given dataset by alias or ID. When getting the content by alias the latest dataset is returned, optionally filtered by the latest available at a given date. ### Parameters - `alias: str` Dataset alias or ID. ### Returns - `str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) dataset = client.radar.datasets.get( "ranking_top_1000", ) print(dataset) ``` ## Get dataset download URL `radar.datasets.download(DatasetDownloadParams**kwargs) -> DatasetDownloadResponse` **post** `/radar/datasets/download` Retrieves an URL to download a single dataset. ### Parameters - `dataset_id: int` - `format: Optional[Literal["JSON", "CSV"]]` Format in which results will be returned. - `"JSON"` - `"CSV"` ### Returns - `class DatasetDownloadResponse: …` - `dataset: Dataset` - `url: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.radar.datasets.download( dataset_id=3, ) print(response.dataset) ``` #### Response ```json { "result": { "dataset": { "url": "https://example.com/download" } } } ``` ## Domain Types ### Dataset List Response - `class DatasetListResponse: …` - `datasets: List[Dataset]` - `id: int` - `description: str` - `meta: object` - `tags: List[str]` - `title: str` - `type: str` ### Dataset Get Response - `str` ### Dataset Download Response - `class DatasetDownloadResponse: …` - `dataset: Dataset` - `url: str`