-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathapi_client.py
37 lines (31 loc) · 940 Bytes
/
api_client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import fire
from os import environ
from src.project import Project
from src.job import Job
def create_project(base_url, client_id, client_secret, team_id, documents_path="documents"):
print("Creating project...")
try:
Project.create(
base_url,
client_id,
client_secret,
team_id=str(team_id),
operations_path="project_configuration.json",
documents_path=documents_path
)
except Exception as e:
raise SystemExit(e)
def get_job_status(base_url, client_id, client_secret, job_id):
try:
Job.get_status(
base_url,
client_id,
client_secret,
job_id=str(job_id),
operations_path="src/get_job_status.json",
)
except Exception as e:
raise SystemExit(e)
if __name__ == "__main__":
environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"
fire.Fire()