Skip to content

Commit

Permalink
feat(client): add event tracking for cli
Browse files Browse the repository at this point in the history
  • Loading branch information
rexzheng324-c committed Apr 2, 2021
1 parent f9e7f90 commit e7a9448
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tensorbay/client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from ..dataset import Data, Segment
from ..utility import TBRN, TBRNType
from .gas import GAS
from .requests import default_config
from .segment import FusionSegmentClient, SegmentClient


Expand Down Expand Up @@ -129,6 +130,7 @@ def cli(ctx: click.Context, access_key: str, url: str, profile_name: str, debug:
"url": url,
"profile_name": profile_name,
}
default_config._x_source = "PYTHON-CLI" # pylint: disable=protected-access

if debug:
logging.basicConfig(level=logging.DEBUG)
Expand Down
3 changes: 2 additions & 1 deletion tensorbay/client/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(self) -> None:

self.timeout = 30
self._is_intern = False
self._x_source = "PYTHON-SDK"

@property
def is_intern(self) -> bool:
Expand Down Expand Up @@ -222,7 +223,7 @@ def open_api_do(
"""
kwargs.setdefault("headers", {})["X-Token"] = self.access_key
kwargs["headers"]["X-Source"] = "PYTHON-SDK"
kwargs["headers"]["X-Source"] = default_config._x_source # pylint: disable=protected-access

return self.do(method=method, url=self._url_make(section, dataset_id), **kwargs)

Expand Down

0 comments on commit e7a9448

Please sign in to comment.