telonyte-brain 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- telonyte_brain-0.1.0/PKG-INFO +20 -0
- telonyte_brain-0.1.0/README.md +11 -0
- telonyte_brain-0.1.0/pyproject.toml +14 -0
- telonyte_brain-0.1.0/setup.cfg +4 -0
- telonyte_brain-0.1.0/src/telonyte_brain/__init__.py +31 -0
- telonyte_brain-0.1.0/src/telonyte_brain.egg-info/PKG-INFO +20 -0
- telonyte_brain-0.1.0/src/telonyte_brain.egg-info/SOURCES.txt +7 -0
- telonyte_brain-0.1.0/src/telonyte_brain.egg-info/dependency_links.txt +1 -0
- telonyte_brain-0.1.0/src/telonyte_brain.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: telonyte-brain
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: B.R.A.I.N. V1 HTTP client for Python.
|
|
5
|
+
Project-URL: Homepage, https://brain.telonyte.com
|
|
6
|
+
Project-URL: Documentation, https://brain.telonyte.com/setup/api
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# telonyte-brain
|
|
11
|
+
|
|
12
|
+
Thin Python client for the B.R.A.I.N. V1 HTTP API.
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
from telonyte_brain import add, find
|
|
16
|
+
add("my-bot", "NEW | The staging deploy runs on Fridays | team notes")
|
|
17
|
+
print("\n".join(find("staging deploy")["lines"]))
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Set `BRAIN_KEY` and optionally `BRAIN_URL`. See the copy-paste examples on https://brain.telonyte.com/setup/api.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# telonyte-brain
|
|
2
|
+
|
|
3
|
+
Thin Python client for the B.R.A.I.N. V1 HTTP API.
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from telonyte_brain import add, find
|
|
7
|
+
add("my-bot", "NEW | The staging deploy runs on Fridays | team notes")
|
|
8
|
+
print("\n".join(find("staging deploy")["lines"]))
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Set `BRAIN_KEY` and optionally `BRAIN_URL`. See the copy-paste examples on https://brain.telonyte.com/setup/api.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "telonyte-brain"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "B.R.A.I.N. V1 HTTP client for Python."
|
|
5
|
+
requires-python = ">=3.9"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
[project.urls]
|
|
8
|
+
Homepage = "https://brain.telonyte.com"
|
|
9
|
+
Documentation = "https://brain.telonyte.com/setup/api"
|
|
10
|
+
[build-system]
|
|
11
|
+
requires = ["setuptools>=69"]
|
|
12
|
+
build-backend = "setuptools.build_meta"
|
|
13
|
+
[tool.setuptools.packages.find]
|
|
14
|
+
where = ["src"]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Tiny HTTP client. Reads BRAIN_URL and BRAIN_KEY from the environment."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
import json, os, urllib.request
|
|
4
|
+
|
|
5
|
+
def _base():
|
|
6
|
+
return os.environ.get("BRAIN_URL", "https://brain.telonyte.com").rstrip("/")
|
|
7
|
+
|
|
8
|
+
def _headers():
|
|
9
|
+
key = os.environ.get("BRAIN_KEY")
|
|
10
|
+
if not key:
|
|
11
|
+
raise RuntimeError("Set BRAIN_KEY")
|
|
12
|
+
return {"Authorization": "Bearer " + key, "content-type": "application/json"}
|
|
13
|
+
|
|
14
|
+
def _post(path, body):
|
|
15
|
+
req = urllib.request.Request(_base() + path, data=json.dumps(body).encode(), headers=_headers(), method="POST")
|
|
16
|
+
with urllib.request.urlopen(req) as r:
|
|
17
|
+
return json.load(r)
|
|
18
|
+
|
|
19
|
+
def status():
|
|
20
|
+
req = urllib.request.Request(_base() + "/v1/status", headers=_headers())
|
|
21
|
+
with urllib.request.urlopen(req) as r:
|
|
22
|
+
return json.load(r)
|
|
23
|
+
|
|
24
|
+
def add(bot, text):
|
|
25
|
+
return _post("/v1/add", {"bot": bot, "text": text})
|
|
26
|
+
|
|
27
|
+
def find(q, n=5):
|
|
28
|
+
return _post("/v1/find", {"q": q, "n": n, "format": "json"})
|
|
29
|
+
|
|
30
|
+
def delete(uid):
|
|
31
|
+
return _post("/v1/delete", {"uid": uid})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: telonyte-brain
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: B.R.A.I.N. V1 HTTP client for Python.
|
|
5
|
+
Project-URL: Homepage, https://brain.telonyte.com
|
|
6
|
+
Project-URL: Documentation, https://brain.telonyte.com/setup/api
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# telonyte-brain
|
|
11
|
+
|
|
12
|
+
Thin Python client for the B.R.A.I.N. V1 HTTP API.
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
from telonyte_brain import add, find
|
|
16
|
+
add("my-bot", "NEW | The staging deploy runs on Fridays | team notes")
|
|
17
|
+
print("\n".join(find("staging deploy")["lines"]))
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Set `BRAIN_KEY` and optionally `BRAIN_URL`. See the copy-paste examples on https://brain.telonyte.com/setup/api.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
telonyte_brain
|