Skip to content

Commit 6ec77ac

Browse files
committed
[client] Remove printing
1 parent c5d391b commit 6ec77ac

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

pyobas/_apis/team.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from typing import Any, Dict, List
2+
3+
from pyobas import exceptions as exc
4+
from pyobas.base import RESTManager, RESTObject
5+
from pyobas.mixins import CreateMixin, ListMixin, UpdateMixin
6+
from pyobas.utils import RequiredOptional
7+
8+
9+
class Team(RESTObject):
10+
_id_attr = "team_id"
11+
12+
13+
class TeamManager(CreateMixin, ListMixin, UpdateMixin, RESTManager):
14+
_path = "/teams"
15+
_obj_cls = Team
16+
_create_attrs = RequiredOptional(
17+
required=("team_name",),
18+
optional=("team_description", "team_organization", "team_tags"),
19+
)
20+
21+
@exc.on_http_error(exc.OpenBASUpdateError)
22+
def upsert(self, team: Dict[str, Any], **kwargs: Any) -> Dict[str, Any]:
23+
path = f"{self.path}/upsert"
24+
result = self.openbas.http_post(path, post_data=team, **kwargs)
25+
return result

pyobas/_apis/user.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from typing import Any, Dict, List
2+
3+
from pyobas import exceptions as exc
4+
from pyobas.base import RESTManager, RESTObject
5+
from pyobas.mixins import CreateMixin, ListMixin, UpdateMixin
6+
from pyobas.utils import RequiredOptional
7+
8+
9+
class User(RESTObject):
10+
_id_attr = "user_id"
11+
12+
13+
class UserManager(CreateMixin, ListMixin, UpdateMixin, RESTManager):
14+
_path = "/players"
15+
_obj_cls = User
16+
_create_attrs = RequiredOptional(
17+
required=("user_email",),
18+
optional=(
19+
"user_firstname",
20+
"user_lastname",
21+
"user_organization",
22+
"user_country",
23+
"user_tags",
24+
),
25+
)
26+
27+
@exc.on_http_error(exc.OpenBASUpdateError)
28+
def upsert(self, user: Dict[str, Any], **kwargs: Any) -> Dict[str, Any]:
29+
path = f"{self.path}/upsert"
30+
result = self.openbas.http_post(path, post_data=user, **kwargs)
31+
return result

pyobas/client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ def http_request(
174174
opts["headers"]["Content-type"] = send_data.content_type
175175

176176
# cur_retries = 0
177-
print(send_data)
178177
while True:
179178
# noinspection PyTypeChecker
180179
result = self._backend.http_request(

0 commit comments

Comments
 (0)