Metadata-Version: 2.4
Name: hytribe
Version: 0.0.1
Summary: Pre-release Python client for the Hytribe API. The REST API is the source of truth.
Project-URL: Documentation, https://sales.hytribe.xyz/developers
Project-URL: Homepage, https://hytribe.xyz
Author-email: Hytribe <hello@hytribe.xyz>
License: MIT
License-File: LICENSE
Keywords: api-client,community,hytribe,matching
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: httpx>=0.24
Description-Content-Type: text/markdown

# hytribe

Pre-release Python client for the [Hytribe API](https://sales.hytribe.xyz/developers).

> **Status: 0.0.x, pre-release.** Published so the name is reserved and early
> integrators have something to `pip install`. The REST API is the source of
> truth and this client surface will change before 1.0. Pin an exact version.
> If you need a stable contract today, call the REST endpoints directly or
> generate a client from the OpenAPI spec.

## Install

```sh
pip install hytribe
```

## Get a key

Registration is the one unauthenticated call — it issues the key everything else
needs, so it is a module-level function rather than a client method. The key is
returned **once** and never again.

```python
from hytribe import register_community

community = register_community(
    name="Acme Engineering",
    platform="slack",
    platform_workspace_id="T0123456789",
)
api_key = community["api_key"]
```

## Use

```python
import os
from hytribe import Hytribe

hy = Hytribe(api_key=os.environ["HYTRIBE_API_KEY"])

hy.upsert_member(
    platform_user_id="usr_84213",
    display_name="Dana R.",
    interests=["climbing", "ml infra"],
    goals=["find a training partner"],
)

result = hy.run_match()
```

### Roles

Keys carry a role, and the calls differ in what they need. Using a viewer key for
`run_match()` gets a 403, which is easy to misread as a bad key.

| Call | Minimum role |
|---|---|
| `list_members()`, `get_community()` | viewer |
| `upsert_member()` | moderator |
| `run_match()` | admin |

Point at the sandbox by overriding the base URL:

```python
hy = Hytribe(
    api_key=os.environ["HYTRIBE_SANDBOX_KEY"],  # ht_test_...
    base_url="https://sandbox.hytribe.xyz",
)
```

## Keys stay server-side

An API key grants full read and write access to your community's member data.
Keep it in your secret manager. Never ship it to a client application.

## Errors

Failures raise `HytribeError` with `status`, `code` and the parsed `body`.

## Support

hello@hytribe.xyz
