Python api client - https://api.objectways.com/docs
Project description
Newton API client
This is python package to call all API from (https://api.objectways.com/docs)
Import package and create a client
"api_url" is and optional parameter for private installs
from pprint import pprint
from objectways import newton
client = newton.Newton(api_url="YOUR_API_URL",api_key="YOUR_API_KEY")
1. Task
1.1. Add new task
body = {
"project_id": "449354de1168469a8229f605",
"file_name": "document.pdf",
"file_type": "application/pdf",
"source": "s3://examples/pdfs/document.pdf"
}
pprint(client.add_task(body))
1.2. Add bulk tasks
body = {
"project_id": "cd1a965e334a9a63e2f17932",
"task_list": [
{
"source": "s3://examples/pdfs/document.pdf",
"annotations": "s3://examples/pdfs/annotation.json"
},
{
"source": "s3://examples/pdfs/document2.pdf"
},
{
"source": "s3://examples/pdfs/document3.pdf",
"annotations": {
"tags": [
{
"page": 1,
"range": [
192,
198
],
"text": "Oxford",
"id": 1,
"type": "NAME"
}
]
}
}
]
}
pprint(client.add_bulk_tasks(body))
1.3. Add labels to task
body = {
"annotations": "s3://examples/pdfs/annotation.json"
}
pprint(client.add_labels_to_task(task_id=task_id,body))
1.4. Add task file
data = client.add_task_file(
project_id="449354de1168469a8229f605",
file_path="examples/pdfs/document.pdf",
mime_type="application/pdf",
annotations=None
)
pprint(data)
1.5. Get Task by task_id
data = client.get_task(
task_id="449354de1168469a8229f605",
)
pprint(data)
1.6. Delete Task by task_id
data = client.delete_task(
task_id="449354de1168469a8229f605",
)
pprint(data)
1.7. Get tasks by filters
- Find all the tasks by
task_id
,file_name
,file_type
andtrail
- If all of
task_id
,file_name
,file_type
areNone
, it will return all possible tasks
tasks = client.get_tasks(
project_id="449354de1168469a8229f605",
task_id="449354de1168469a8229f605-0",
file_name=None,
file_type=None,
trail = False
)
pprint(tasks)
1.8. Export Tasks by project_id
data = client.export_tasks(
project_id="449354de1168469a8229f605",
)
pprint(data)
2. Project
2.1. Create a new project
body = {
"project_name": "TestProject",
"project_type": "NER",
"enable_text_mode_option": true,
"disable_quality_audit": true,
...
}
# check API docs for the full body: https://api.objectways.com/docs/#/projects/upload_project
pprint(client.create_project(body))
2.2. Get project by project_id
projects = client.get_project(
project_id="449354de1168469a8229f605",
)
2.3. Update project
body = {
"project_name": "TestProject",
"project_type": "NER",
"enable_text_mode_option": true,
"disable_quality_audit": true,
...
}
projects = client.update_project(
project_id="449354de1168469a8229f605",
body=body
)
2.4. Delete project
response = client.delete_project(
project_id="449354de1168469a8229f605",
)
2.5. Get projects by Filters
- Find all the projects by
project_id
,project_name
oractive
- If all of
project_id
,project_name
,active
areNone
, it will return all possible projects
projects = client.get_projects(
project_id="449354de1168469a8229f605",
project_name=None,
active: bool=None
)
3. Team Management
3.1. Add member to the team
member = client.add_team_member(
project_id="449354de1168469a8229f605",
email="someone@email.com",
role="annotator|reviewer|supervisor"
)
3.2. Add member to the project team
team = client.get_project_team_members(
project_id="449354de1168469a8229f605",
)
3.3. Remove member from the project team
team = client.remove_project_team_member(
project_id="449354de1168469a8229f605",
)
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
Built Distribution
File details
Details for the file newton-api-client-1.0.7.tar.gz
.
File metadata
- Download URL: newton-api-client-1.0.7.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff11d44a1b659cf76454b45959274bf6be3e6a289103039b76446a11c2b80a07 |
|
MD5 | f0368fb3a7017758e8119d9dbda662c8 |
|
BLAKE2b-256 | 09bd3b1151f892f69a72f6fe47a5c028ed63a876907d4a0bcc196f195ba3c76b |
File details
Details for the file newton_api_client-1.0.7-py3-none-any.whl
.
File metadata
- Download URL: newton_api_client-1.0.7-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76a6a5f5c16fc9ca44a02441c4ca5f316251dcc5a9488935f0a04697ec5f84bd |
|
MD5 | b710d02ee80168e5a24b4e931fa7e7b0 |
|
BLAKE2b-256 | a03d267b7f8d29c24c010777bbd27d49c4e486c86a21347de23c63f073e871ed |