Skip to content

Commit 2992fb9

Browse files
committed
[client] Add tag.py
1 parent 392852a commit 2992fb9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pyobas/apis/tag.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from typing import Any, Dict
2+
3+
from pyobas import exceptions as exc
4+
from pyobas.base import RESTManager, RESTObject
5+
6+
7+
class Tag(RESTObject):
8+
_id_attr = "tag_id"
9+
10+
11+
class TagManager(RESTManager):
12+
_path = "/tags"
13+
_obj_cls = Tag
14+
15+
@exc.on_http_error(exc.OpenBASUpdateError)
16+
def upsert(self, data: Dict[str, Any], **kwargs: Any) -> Dict[str, Any]:
17+
path = f"{self.path}/upsert"
18+
result = self.openbas.http_post(path, post_data=data, **kwargs)
19+
return result

0 commit comments

Comments
 (0)