-
Notifications
You must be signed in to change notification settings - Fork 62
/
do_datasets.py
46 lines (31 loc) · 970 Bytes
/
do_datasets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
"""
Module for working with Data Observatory Datasets
.. module:: carto.do_datasets
:platform: Unix, Windows
:synopsis: Module for working with Data Observatory Datasets
.. moduleauthor:: Jesús Arroyo <jarroyo@carto.com>
"""
from pyrestcli.fields import CharField
from .resources import Resource, Manager
from .paginators import CartoPaginator
API_VERSION = "v4"
API_ENDPOINT = "api/{api_version}/do/datasets"
class DODataset(Resource):
"""
Represents a Data Observatory Datasets object in CARTO.
"""
dataset = CharField()
id = CharField()
project = CharField()
table = CharField()
class Meta:
collection_endpoint = API_ENDPOINT.format(api_version=API_VERSION)
name_field = "id"
class DODatasetManager(Manager):
"""
Manager for the DODataset class.
"""
resource_class = DODataset
json_collection_attribute = "datasets"
paginator_class = CartoPaginator