diff --git a/integrations/jira/jira/client.py b/integrations/jira/jira/client.py index 3d8e31e1f1..9860c0e126 100644 --- a/integrations/jira/jira/client.py +++ b/integrations/jira/jira/client.py @@ -1,3 +1,4 @@ +import asyncio import typing from typing import Any, AsyncGenerator @@ -49,20 +50,24 @@ def _generate_base_req_params( } async def _get_paginated_projects(self, params: dict[str, Any]) -> dict[str, Any]: - project_response = self.client.get( - f"{self.api_url}/project/search", params=params + project_response = await asyncio.to_thread( + self.client.get, f"{self.api_url}/project/search", params=params ) project_response.raise_for_status() return project_response.json() async def _get_paginated_issues(self, params: dict[str, Any]) -> dict[str, Any]: - issue_response = self.client.get(f"{self.api_url}/search", params=params) + issue_response = await asyncio.to_thread( + self.client.get, f"{self.api_url}/search", params=params + ) issue_response.raise_for_status() return issue_response.json() async def create_events_webhook(self, app_host: str) -> None: webhook_target_app_host = f"{app_host}/integration/webhook" - webhook_check_response = self.client.get(f"{self.webhooks_url}") + webhook_check_response = await asyncio.to_thread( + self.client.get, f"{self.webhooks_url}" + ) webhook_check_response.raise_for_status() webhook_check = webhook_check_response.json() @@ -77,15 +82,15 @@ async def create_events_webhook(self, app_host: str) -> None: "events": WEBHOOK_EVENTS, } - webhook_create_response = self.client.post( - f"{self.webhooks_url}", json=body + webhook_create_response = await asyncio.to_thread( + self.client.post, f"{self.webhooks_url}", json=body ) webhook_create_response.raise_for_status() logger.info("Ocean real time reporting webhook created") async def get_single_project(self, project_key: str) -> dict[str, Any]: - project_response = self.client.get( - f"{self.api_url}/project/{project_key}" + project_response = await asyncio.to_thread( + self.client.get, f"{self.api_url}/project/{project_key}" ) project_response.raise_for_status() return project_response.json() @@ -114,7 +119,9 @@ async def get_paginated_projects( params["startAt"] += PAGE_SIZE async def get_single_issue(self, issue_key: str) -> dict[str, Any]: - issue_response = self.client.get(f"{self.api_url}/issue/{issue_key}") + issue_response = await asyncio.to_thread( + self.client.get, f"{self.api_url}/issue/{issue_key}" + ) issue_response.raise_for_status() return issue_response.json() diff --git a/integrations/jira/pyproject.toml b/integrations/jira/pyproject.toml index a6f47af1dd..51e989b144 100644 --- a/integrations/jira/pyproject.toml +++ b/integrations/jira/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "jira" -version = "0.1.89-dev018" +version = "0.1.89-dev026" description = "Integration to bring information from Jira into Port" authors = ["Mor Paz "]