-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclient.py
More file actions
33 lines (24 loc) · 858 Bytes
/
client.py
File metadata and controls
33 lines (24 loc) · 858 Bytes
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
from dataclasses import dataclass, field
from cloudquery.sdk.scheduler import Client as ClientABC
from plugin.example.client import ExampleClient
DEFAULT_CONCURRENCY = 100
DEFAULT_QUEUE_SIZE = 10000
@dataclass
class Spec:
access_token: str
base_url: str = field(default="https://api.example.com")
concurrency: int = field(default=DEFAULT_CONCURRENCY)
queue_size: int = field(default=DEFAULT_QUEUE_SIZE)
def validate(self):
pass
# if self.access_token is None:
# raise Exception("access_token must be provided")
class Client(ClientABC):
def __init__(self, spec: Spec) -> None:
self._spec = spec
self._client = ExampleClient(spec.access_token, spec.base_url)
def id(self):
return "example"
@property
def client(self) -> ExampleClient:
return self._client