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

Function create_transaction

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

Source from the content-addressed store, hash-verified

68 raise Exception(f"Failed to create TF-IDF index: {response.text}")
69
70def create_transaction(name):
71 url = f"{client.base_url}/collections/{name}/transactions"
72 response = requests.post(
73 url,
74 headers=client._get_headers(),
75 verify=client.verify_ssl,
76 )
77
78 if response.status_code not in [200, 201]:
79 raise Exception(f"Failed to create transaction: {response.text}")
80
81 result = response.json()
82 transaction_id = result["transaction_id"]
83 return transaction_id
84
85def commit_transaction(name, txn_id):
86 url = f"{client.base_url}/collections/{name}/transactions/{txn_id}/commit"

Callers 1

mainFunction · 0.70

Calls 1

_get_headersMethod · 0.45

Tested by

no test coverage detected