Skip to content

Commit 335084d

Browse files
committed
Add headers with api-key for requests to endpoints requiring this in datastore-api
1 parent fe70533 commit 335084d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

job_executor/adapter/datastore_api/__init__.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ def get_jobs(
7373
if query_fields:
7474
request_url += f"?{'&'.join(query_fields)}"
7575

76-
response = execute_request("GET", request_url, True)
76+
response = execute_request("GET", request_url, True, headers={
77+
"X-API-Key": DATASTORE_API_SERVICE_KEY,
78+
},)
7779
return [Job.model_validate(job) for job in response.json()]
7880

7981

@@ -83,14 +85,21 @@ def update_job_status(
8385
payload: dict[str, JobStatus | str] = {"status": str(new_status)}
8486
if log is not None:
8587
payload.update({"log": log})
86-
execute_request("PUT", f"{DATASTORE_API_URL}/jobs/{job_id}", json=payload)
88+
execute_request("PUT", f"{DATASTORE_API_URL}/jobs/{job_id}", json=payload, headers={
89+
"Content-Type": "application/json",
90+
"X-API-Key": DATASTORE_API_SERVICE_KEY,
91+
},)
8792

8893

8994
def update_description(job_id: str, new_description: str) -> None:
9095
execute_request(
9196
"PUT",
9297
f"{DATASTORE_API_URL}/jobs/{job_id}",
9398
json={"description": new_description},
99+
headers={
100+
"Content-Type": "application/json",
101+
"X-API-Key": DATASTORE_API_SERVICE_KEY,
102+
}
94103
)
95104

96105

0 commit comments

Comments
 (0)