-
Notifications
You must be signed in to change notification settings - Fork 2
/
syncthing.py
50 lines (38 loc) · 1.08 KB
/
syncthing.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
47
48
49
50
"""Entrypoint for the Syncthing REST API."""
from .api import API
from .database import Database
from .events import Events
from .system import System
class Syncthing:
"""Entrypoint class."""
def __init__(self, *args, **kwargs):
"""Initialize the client."""
self._api = API(*args, **kwargs)
self._system = System(self._api)
self._database = Database(self._api)
self._events = Events(self._api)
@property
def url(self):
"""Get URL."""
return self._api.url
@property
def system(self):
"""Get system api."""
return self._system
@property
def database(self):
"""Get database api."""
return self._database
@property
def events(self):
"""Get events api."""
return self._events
async def close(self):
"""Close open client session."""
await self._api.close()
async def __aenter__(self):
"""Async enter."""
return self
async def __aexit__(self, *exc_info):
"""Async exit."""
await self.close()