stackresolve 0.1.0__tar.gz → 0.2.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.
- stackresolve-0.2.0/.gitignore +21 -0
- {stackresolve-0.1.0 → stackresolve-0.2.0}/PKG-INFO +1 -1
- {stackresolve-0.1.0 → stackresolve-0.2.0}/pyproject.toml +1 -1
- {stackresolve-0.1.0 → stackresolve-0.2.0}/stackresolve/__init__.py +1 -1
- {stackresolve-0.1.0 → stackresolve-0.2.0}/stackresolve/client.py +22 -1
- stackresolve-0.1.0/.gitignore +0 -10
- {stackresolve-0.1.0 → stackresolve-0.2.0}/README.md +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
node_modules/
|
|
2
|
+
node_modules
|
|
3
|
+
.next/
|
|
4
|
+
.env*
|
|
5
|
+
!.env.example
|
|
6
|
+
.DS_Store
|
|
7
|
+
*.log
|
|
8
|
+
/.claude/worktrees/
|
|
9
|
+
|
|
10
|
+
# prior-work semantic vector cache (machine-local)
|
|
11
|
+
.claude/cache/
|
|
12
|
+
|
|
13
|
+
# playwright e2e artifacts
|
|
14
|
+
test-results/
|
|
15
|
+
playwright-report/
|
|
16
|
+
blob-report/
|
|
17
|
+
playwright/.cache/
|
|
18
|
+
**/e2e/.auth/
|
|
19
|
+
|
|
20
|
+
# SEO submit run logs (per-run audit trail, written by scripts/seo/*)
|
|
21
|
+
scripts/seo/index-submit-log.tsv
|
|
@@ -41,6 +41,11 @@ class StackResolve:
|
|
|
41
41
|
base_url: Base URL override. Falls back to STACKRESOLVE_BASE_URL,
|
|
42
42
|
then https://api.stackresolve.dev .
|
|
43
43
|
timeout: Per-request timeout in seconds (default 60).
|
|
44
|
+
integration: Identifies the caller in the User-Agent, e.g.
|
|
45
|
+
"langchain-stackresolve/0.1.0". Framework adapters set this so a call
|
|
46
|
+
through an adapter is distinguishable from a raw SDK call. Without it
|
|
47
|
+
every caller looks identical to the API and we cannot tell which
|
|
48
|
+
distribution surface is working.
|
|
44
49
|
"""
|
|
45
50
|
|
|
46
51
|
def __init__(
|
|
@@ -48,15 +53,31 @@ class StackResolve:
|
|
|
48
53
|
api_key: Optional[str] = None,
|
|
49
54
|
base_url: Optional[str] = None,
|
|
50
55
|
timeout: float = 60.0,
|
|
56
|
+
integration: Optional[str] = None,
|
|
51
57
|
) -> None:
|
|
52
58
|
self.api_key = api_key or os.environ.get("STACKRESOLVE_API_KEY")
|
|
53
59
|
base = base_url or os.environ.get("STACKRESOLVE_BASE_URL") or DEFAULT_BASE_URL
|
|
54
60
|
self.base_url = base.rstrip("/")
|
|
55
|
-
|
|
61
|
+
self.integration = integration or os.environ.get("STACKRESOLVE_INTEGRATION")
|
|
62
|
+
headers = {"accept": "application/json", "user-agent": self._user_agent()}
|
|
56
63
|
if self.api_key:
|
|
57
64
|
headers["x-api-key"] = self.api_key
|
|
58
65
|
self._client = httpx.Client(base_url=self.base_url, headers=headers, timeout=timeout)
|
|
59
66
|
|
|
67
|
+
def _user_agent(self) -> str:
|
|
68
|
+
"""Identify the SDK, and the adapter on top of it when there is one."""
|
|
69
|
+
from . import __version__
|
|
70
|
+
|
|
71
|
+
ua = f"stackresolve-python/{__version__}"
|
|
72
|
+
# Keep it to the printable subset a header allows; a label is a package
|
|
73
|
+
# name, never user input, but the SDK should not be the thing that
|
|
74
|
+
# produces an invalid header.
|
|
75
|
+
if self.integration:
|
|
76
|
+
safe = "".join(c for c in self.integration if c.isprintable() and c not in '\r\n')[:80]
|
|
77
|
+
if safe:
|
|
78
|
+
ua += f" ({safe})"
|
|
79
|
+
return ua
|
|
80
|
+
|
|
60
81
|
# ---- context manager + cleanup ----
|
|
61
82
|
|
|
62
83
|
def close(self) -> None:
|
stackresolve-0.1.0/.gitignore
DELETED
|
File without changes
|