MCPcopy Create free account
hub / github.com/cosdata/cosdata / lookup

Function lookup

tests/test-key-value-store-simple.py:127–143  ·  view source on GitHub ↗
(name, key)

Source from the content-addressed store, hash-verified

125
126
127def lookup(name, key):
128 url = f"{client.base_url}/collections/{name}/search/key-value"
129 data = {
130 "key": key
131 }
132
133 response = requests.post(
134 url,
135 headers=client._get_headers(),
136 data=json.dumps(data),
137 verify=client.verify_ssl,
138 )
139
140 if response.status_code != 200:
141 raise Exception(f"Failed to search dense vector: {response.text}")
142
143 return bytes(response.json()["bytes"]).decode("utf-8")
144
145def main():
146 # Initialize client session

Callers 1

mainFunction · 0.70

Calls 1

_get_headersMethod · 0.45

Tested by

no test coverage detected