MCPcopy Create free account
hub / github.com/instantdb/instant / _headers

Method _headers

client/packages/python/src/instantdb/_async/http.py:51–68  ·  view source on GitHub ↗
(
        self, *, unauthenticated: bool = False, admin_only: bool = False
    )

Source from the content-addressed store, hash-verified

49 self._owns_client = True
50
51 def _headers(
52 self, *, unauthenticated: bool = False, admin_only: bool = False
53 ) -> dict[str, str]:
54 if unauthenticated:
55 return {"content-type": "application/json"}
56 self._validate_auth()
57 h: dict[str, str] = {
58 "content-type": "application/json",
59 "app-id": self._app_id,
60 "Instant-Admin-Version": __version__,
61 "Instant-Core-Version": __version__,
62 }
63 if self._admin_token:
64 h["authorization"] = f"Bearer {self._admin_token}"
65 # admin_only skips impersonation so the request uses admin auth.
66 if not admin_only:
67 h.update(self._impersonation)
68 return h
69
70 def _validate_auth(self) -> None:
71 if self._admin_token:

Callers 5

put_binaryMethod · 0.95
_requestMethod · 0.95
_connect_and_consumeMethod · 0.45
_send_internalMethod · 0.45
_runMethod · 0.45

Calls 2

_validate_authMethod · 0.95
updateMethod · 0.45

Tested by

no test coverage detected