Skip to content

Commit

Permalink
test sync requests again
Browse files Browse the repository at this point in the history
  • Loading branch information
talsabagport committed Oct 21, 2024
1 parent 979628e commit 85deb75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
25 changes: 7 additions & 18 deletions integrations/jira/jira/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import asyncio
import typing
from typing import Any, AsyncGenerator

Expand Down Expand Up @@ -50,24 +49,20 @@ def _generate_base_req_params(
}

async def _get_paginated_projects(self, params: dict[str, Any]) -> dict[str, Any]:
project_response = await asyncio.to_thread(
self.client.get, f"{self.api_url}/project/search", params=params
project_response = 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 = await asyncio.to_thread(
self.client.get, f"{self.api_url}/search", params=params
)
issue_response = 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 = await asyncio.to_thread(
self.client.get, f"{self.webhooks_url}"
)
webhook_check_response = self.client.get(f"{self.webhooks_url}")
webhook_check_response.raise_for_status()
webhook_check = webhook_check_response.json()

Expand All @@ -82,16 +77,12 @@ async def create_events_webhook(self, app_host: str) -> None:
"events": WEBHOOK_EVENTS,
}

webhook_create_response = await asyncio.to_thread(
self.client.post, f"{self.webhooks_url}", json=body
)
webhook_create_response = 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 = await asyncio.to_thread(
self.client.get, f"{self.api_url}/project/{project_key}"
)
project_response = self.client.get(f"{self.api_url}/project/{project_key}")
project_response.raise_for_status()
return project_response.json()

Expand Down Expand Up @@ -119,9 +110,7 @@ async def get_paginated_projects(
params["startAt"] += PAGE_SIZE

async def get_single_issue(self, issue_key: str) -> dict[str, Any]:
issue_response = await asyncio.to_thread(
self.client.get, f"{self.api_url}/issue/{issue_key}"
)
issue_response = self.client.get(f"{self.api_url}/issue/{issue_key}")
issue_response.raise_for_status()
return issue_response.json()

Expand Down
2 changes: 1 addition & 1 deletion integrations/jira/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "jira"
version = "0.1.89-dev024"
version = "0.1.89-dev025"
description = "Integration to bring information from Jira into Port"
authors = ["Mor Paz <mor@getport.io>"]

Expand Down

0 comments on commit 85deb75

Please sign in to comment.