diff --git a/job_executor/adapter/datastore_api/__init__.py b/job_executor/adapter/datastore_api/__init__.py index 1e7ad6b..709b844 100644 --- a/job_executor/adapter/datastore_api/__init__.py +++ b/job_executor/adapter/datastore_api/__init__.py @@ -73,7 +73,14 @@ def get_jobs( if query_fields: request_url += f"?{'&'.join(query_fields)}" - response = execute_request("GET", request_url, True) + response = execute_request( + "GET", + request_url, + True, + headers={ + "X-API-Key": DATASTORE_API_SERVICE_KEY, + }, + ) return [Job.model_validate(job) for job in response.json()] @@ -83,7 +90,15 @@ def update_job_status( payload: dict[str, JobStatus | str] = {"status": str(new_status)} if log is not None: payload.update({"log": log}) - execute_request("PUT", f"{DATASTORE_API_URL}/jobs/{job_id}", json=payload) + execute_request( + "PUT", + f"{DATASTORE_API_URL}/jobs/{job_id}", + json=payload, + headers={ + "Content-Type": "application/json", + "X-API-Key": DATASTORE_API_SERVICE_KEY, + }, + ) def update_description(job_id: str, new_description: str) -> None: @@ -91,6 +106,10 @@ def update_description(job_id: str, new_description: str) -> None: "PUT", f"{DATASTORE_API_URL}/jobs/{job_id}", json={"description": new_description}, + headers={ + "Content-Type": "application/json", + "X-API-Key": DATASTORE_API_SERVICE_KEY, + }, )