SDK de PythonVista previa

Cliente para Python 3.11 con requests.

Terminal
pip install tinkay

Uso

Python
import osfrom tinkay import Tinkaytinkay = Tinkay(api_key=os.environ["TINKAY_API_KEY"])contact = tinkay.contacts.create(    name="Camila Rodríguez",    email="[email protected]",    company="Kipu Pagos",)tinkay.tickets.create(    subject="Error 500 al exportar",    description="Reportado desde el panel interno.",    contact_id=contact["id"],    priority="high",)for c in tinkay.contacts.list():    print(c["email"])

Sin SDK

tinkay_client.py
import osimport requestsBASE = "https://api.tinkay.app/v1"class TinkayError(Exception):    passclass Tinkay:    def __init__(self, api_key: str | None = None):        self.session = requests.Session()        self.session.headers["Authorization"] = f"Bearer {api_key or os.environ['TINKAY_API_KEY']}"    def _request(self, method: str, path: str, **kwargs):        res = self.session.request(method, BASE + path, timeout=15, **kwargs)        if not res.ok:            detail = res.json().get("error", {}).get("message", res.reason)            raise TinkayError(f"Tinkay {res.status_code}: {detail}")        return res.json()    def create_contact(self, **fields):        return self._request("POST", "/contacts", json=fields)["data"]    def list_contacts(self):        cursor = None        while True:            params = {"limit": 100, **({"cursor": cursor} if cursor else {})}            page = self._request("GET", "/contacts", params=params)            yield from page["data"]            cursor = page["next_cursor"]            if not cursor:                break