Abstra Lib
Reason this release was yanked:
Deprecated
Project description
abstra lib
Python package for abstra products
Hooks
from abstra.hooks import get_request, send_response, send_json
# helper to get request
body, query, headers = get_request()
# helper to send response
send_response(body='DONE', status_code=207, headers={"Session": 123})
# helper to send json response
send_json(data={"ok": True})
Testing locally
If you are testing the script locally you can pass an optional argument to read/write from a specified file.
Defaults to request.json
and response.json
from abstra.hooks import get_request, send_response
# helper to get request
body, query, headers = get_request(local_file="request.json")
# helper to send response
send_response(body='DONE', local_file="response.json")
- the request local_file should be a json file with fields:
body (raw text)
,headers (key-value map)
andquery (key-value map)
- the response local_file should output to a json file with fields:
body (raw text)
,headers (key-value map)
andstatus_code (number)
Tables
from abstra.tables import Tables
# instantiate a Tables object
tables = Tables()
# you can also authenticate with API key
tables = Tables(api_key="YOUR_API_KEY")
# get the statement
statement = tables.statement(id="STATEMENT_ID")
# and run it
result = statement.run(params={"a": 1, "b": 2})
# or run without instantiating the statement
result = tables.run_statement(id="STATEMENT_ID", params={"a": 1, "b": 2})
Connectors
from abstra.connectors import Connectors
# instantiate a Connectors object
connectors = Connectors()
# you can also authenticate with API key
connectors = Connectors(api_key="YOUR_API_KEY")
# get the statement
method = connectors.method(id="METHOD_ID")
# and run it
result = method.run(params={"a": 1, "b": 2})
# or run without instantiating the method
result = connectors.run_method(id="METHOD_ID", params={"a": 1, "b": 2})
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
abstra-0.33.2.tar.gz
(6.1 MB
view hashes)