Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions docs/source/Services/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,32 +197,6 @@ Send SMS to phone number
"message": "Test",
}
)
=======
TagoTiP
=======

Send a command to a device through TagoTiP

Requires a Service Authorization token in the module token.

**Parameters:**

| **command**: :ref:`TagoTiPCommand`
| Command object with serial, protocol and body

.. code-block::
:caption: **Example:**

from tagoio_sdk import Services

services = Services({"token": "your-service-authorization-token"})
services.tagotip.cmd(
{
"serial": "mqtt1",
"protocol": "mqtt",
"body": "reboot-now",
}
)


.. toctree::
Expand All @@ -233,7 +207,6 @@ Requires a Service Authorization token in the module token.
Notification_Type
Pdf_Type
SMS_Type
TagoTiP_Type



Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
**TagoTiP Type**
===================
================


.. _TagoTiPCommand:
Expand Down
54 changes: 54 additions & 0 deletions docs/source/TagoTiP/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
**TagoTiP**
===========

========
Instance
========

**Parameters:**

| **token**: str
| Service Authorization token.

| *Optional* **region**: str "us-e1" or "ue-w1" or "env"
| Region is a optional parameter

.. code-block::
:caption: **Example:**

from tagoio_sdk import TagoTiP

tagotip = TagoTiP({"token": "your-service-authorization-token"})


===
cmd
===

Send a command to a device through TagoTiP

Requires a Service Authorization token in the module token.

**Parameters:**

| **command**: :ref:`TagoTiPCommand`
| Command object with serial, protocol and body

.. code-block::
:caption: **Example:**

from tagoio_sdk import TagoTiP

tagotip = TagoTiP({"token": "your-service-authorization-token"})
tagotip.cmd(
{
"serial": "mqtt1",
"protocol": "mqtt",
"body": "reboot-now",
}
)


.. toctree::

TagoTiP_Type
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ API Reference
Resources/index
Device/index
Services/index
TagoTiP/index
Utils/index

.. toctree::
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "tagoio-sdk"
version = "5.1.5"
version = "5.1.6"
description = "Official Python SDK for TagoIO"
authors = [{name = "TagoIO Inc.", email = "contact@tago.io"}]
license = {text = "Apache-2.0"}
Expand Down
3 changes: 2 additions & 1 deletion src/tagoio_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from .modules.Resources.AccountDeprecated import AccountDeprecated as Account
from .modules.Resources.Resources import Resources
from .modules.Services.Services import Services
from .modules.TagoTiP.TagoTiP import TagoTiP


__all__ = ["Analysis", "Device", "Account", "Resources", "Services"]
__all__ = ["Analysis", "Device", "Account", "Resources", "Services", "TagoTiP"]
2 changes: 0 additions & 2 deletions src/tagoio_sdk/modules/Services/Services.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from tagoio_sdk.modules.Services.Notification import Notification
from tagoio_sdk.modules.Services.PDF import PDFService
from tagoio_sdk.modules.Services.SMS import SMS
from tagoio_sdk.modules.Services.TagoTiP import TagoTiP
from tagoio_sdk.params import get_params


Expand All @@ -24,4 +23,3 @@ def __init__(self, params: Optional[GenericModuleParams] = None):
self.Notification = Notification(self.params)
self.Attachment = Attachment(self.params)
self.PDF = PDFService(self.params)
self.tagotip = TagoTiP(self.params)
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def cmd(self, command: TagoTiPCommand) -> str:
:param TagoTiPCommand command: Command object with serial, protocol and body

Example:
>>> from tagoio_sdk import Services
>>> services = Services({"token": "your-service-authorization-token"})
>>> services.tagotip.cmd({
>>> from tagoio_sdk import TagoTiP
>>> tagotip = TagoTiP({"token": "your-service-authorization-token"})
>>> tagotip.cmd({
... "serial": "mqtt1",
... "protocol": "mqtt",
... "body": "reboot-now",
Expand Down
18 changes: 6 additions & 12 deletions tests/Services/test_tagotip.py → tests/TagoTiP/test_tagotip.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
import os

from requests_mock.mocker import Mocker

from tagoio_sdk.modules.Services.Services import Services


os.environ["T_ANALYSIS_TOKEN"] = "your_token_value"
from tagoio_sdk import TagoTiP


def testTagoTiPCmd(requests_mock: Mocker) -> None:
"""Test cmd method of TagoTiP service."""
requests_mock.post(
"https://api.tago.io/tip/cmd", json={"status": True, "result": "ok"}
)
"""Test cmd method of TagoTiP client."""
requests_mock.post("https://api.tago.io/tip/cmd", json={"status": True, "result": "ok"})

services = Services({"token": "your-service-authorization-token"})
tagotip = TagoTiP({"token": "your-service-authorization-token"})

result = services.tagotip.cmd(
result = tagotip.cmd(
{
"serial": "mqtt1",
"protocol": "mqtt",
Expand All @@ -30,3 +23,4 @@ def testTagoTiPCmd(requests_mock: Mocker) -> None:
"protocol": "mqtt",
"body": "reboot-now",
}
assert requests_mock.last_request.headers["token"] == "your-service-authorization-token"
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading