Skip to content

Commit 2e9fda7

Browse files
author
Lukas Pfannschmidt
authored
fix(api): correctly pass headers to client (#85)
* fix(api): correctly pass headers to client * fix cassette * fix _all_ cassette records * ensure backwards compatibility through argument order
1 parent ae07904 commit 2e9fda7

12 files changed

Lines changed: 33 additions & 21 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/PyCQA/autoflake
3-
rev: v1.4
3+
rev: v2.2.1
44
hooks:
55
- id: autoflake
66
name: autoflake (python)

superai/apis/data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class DataApiMixin(ABC):
1010
_resource = "data"
1111

1212
@abstractmethod
13-
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False):
13+
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False, header_params=None):
1414
pass
1515

1616
@property

superai/apis/data_program.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class DataProgramApiMixin(WorkflowApiMixin):
1111
@abstractmethod
12-
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False):
12+
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False, header_params=None):
1313
pass
1414

1515
@logdecorator.log_on_start(

superai/apis/ground_truth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class GroundTruthApiMixin(ABC):
66
@abstractmethod
7-
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False):
7+
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False, header_params=None):
88
pass
99

1010
def create_ground_truth(

superai/apis/jobs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class JobsApiMixin(ABC):
1818
@abstractmethod
19-
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False):
19+
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False, header_params=None):
2020
pass
2121

2222
def create_jobs(

superai/apis/operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class OperationsApiMixin(ABC):
99
@abstractmethod
10-
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False):
10+
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False, header_params=None):
1111
pass
1212

1313
def get_operation_download_info(

superai/apis/project.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class ProjectApiMixin(ABC):
1111
@abstractmethod
12-
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False):
12+
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False, header_params=None):
1313
pass
1414

1515
@logdecorator.log_on_start(
@@ -72,6 +72,7 @@ def get_project(self, uuid, **kwargs):
7272
method="GET",
7373
query_params=query_params,
7474
body_params=body_params,
75+
header_params=header_params,
7576
required_api_key=True,
7677
)
7778

@@ -136,6 +137,7 @@ def get_selected_workflow(self, uuid, **kwargs):
136137
method="GET",
137138
query_params=query_params,
138139
body_params=body_params,
140+
header_params=header_params,
139141
required_api_key=True,
140142
)
141143

@@ -232,6 +234,7 @@ def list_projects(self, **kwargs):
232234
method="GET",
233235
query_params=query_params,
234236
body_params=body_params,
237+
header_params=header_params,
235238
required_api_key=True,
236239
)
237240

@@ -306,6 +309,7 @@ def update_project(self, uuid, body, **kwargs):
306309
method="PATCH",
307310
query_params=query_params,
308311
body_params=body_params,
312+
header_params=header_params,
309313
required_api_key=True,
310314
)
311315

@@ -378,5 +382,6 @@ def create_project(self, body, org=None, **kwargs):
378382
method="POST",
379383
query_params=query_params,
380384
body_params=body_params,
385+
header_params=header_params,
381386
required_api_key=True,
382387
)

superai/apis/super_task.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class SuperTaskApiMixin(ABC):
1111
@abstractmethod
12-
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False):
12+
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False, header_params=None):
1313
pass
1414

1515
@logdecorator.log_on_start(
@@ -83,6 +83,7 @@ def get_supertask(self, task_template_name, **kwargs):
8383
method="GET",
8484
query_params=query_params,
8585
body_params=body_params,
86+
header_params=header_params,
8687
required_api_key=True,
8788
)
8889

@@ -184,6 +185,7 @@ def list_supertasks(self, **kwargs):
184185
method="GET",
185186
query_params=query_params,
186187
body_params=body_params,
188+
header_params=header_params,
187189
required_api_key=True,
188190
)
189191

@@ -269,6 +271,7 @@ def put_supertask(self, task_template_name, body, **kwargs):
269271
method="PUT",
270272
query_params=query_params,
271273
body_params=body_params,
274+
header_params=header_params,
272275
required_api_key=True,
273276
required_auth_token=True,
274277
)

superai/apis/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class TasksApiMixin(ABC):
1717
@abstractmethod
18-
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False):
18+
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False, header_params=None):
1919
pass
2020

2121
def download_tasks(

superai/apis/workflow.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class WorkflowApiMixin(ABC):
1010
@abstractmethod
11-
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False):
11+
def request(self, uri, method, body_params=None, query_params=None, required_api_key=False, header_params=None):
1212
pass
1313

1414
@logdecorator.log_on_start(
@@ -72,6 +72,7 @@ def get_workflow(self, workflow_name, **kwargs):
7272
method="GET",
7373
query_params=query_params,
7474
body_params=body_params,
75+
header_params=header_params,
7576
required_api_key=True,
7677
)
7778

@@ -173,6 +174,7 @@ def list_workflows(self, **kwargs):
173174
method="GET",
174175
query_params=query_params,
175176
body_params=body_params,
177+
header_params=header_params,
176178
required_api_key=True,
177179
)
178180

@@ -255,6 +257,7 @@ def put_workflow(self, workflow_name, body, **kwargs):
255257
method="PUT",
256258
query_params=query_params,
257259
body_params=body_params,
260+
header_params=header_params,
258261
required_api_key=True,
259262
required_auth_token=True,
260263
)

0 commit comments

Comments
 (0)