-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I assumed that this would have a high-level library similar to the Java API with the best practices in use, including handling of requests limit etc. However, there's very little documentation and a simplest test script showed that it is far from usable for even the simplest test cases. Code inspection confirmed it. At this time (version 0.0.3) it is probably better document that this is WIP and ask users to go with requests and follow the low-level curl examples.
from pyarcade.api.sync import SyncClient
def instantiation():
return SyncClient(
host="127.0.0.1", port="2480", username=os.environ['DB_USER'], password=os.environ['DB_PASS']
)
# compare to
# curl -X GET http://127.0.0.1:2480/api/v1/server --user...
def test_sync_client_get():
endpoint = "/api/v1/server"
client = instantiation()
client.get(endpoint)
# compare to
# curl -X POST http://127.0.0.1:2480/api/v1/command/arcade_testdb --user ... \
# -d '{ "language": "sql", "command": "select * from schema:database" }' \
# -H "Content-Type: application/json"
def test_sync_client_post():
endpoint = "/api/v1/command/arcade_testdb"
payload={ "language": "sql", "command": "select * from schema:database" }
client = instantiation()
client.post(endpoint, payload=payload)
# Not working as expect yet
print('get', test_sync_client_get())
# Not working as expect yet
print('post', test_sync_client_post())
got
get None
and
WARNING:root:No content type, defaulting to application/json
post None
respectively.
Metadata
Metadata
Assignees
Labels
No labels