Skip to content

Conversation

@albertsola
Copy link
Contributor

No description provided.

@albertsola albertsola force-pushed the MPT-12360/async-HTTP-layer-with-Httpx branch from 17c6bbf to 6cc5002 Compare August 21, 2025 14:37
@albertsola albertsola requested a review from jentyk August 21, 2025 14:40
@albertsola albertsola force-pushed the MPT-12360/async-HTTP-layer-with-Httpx branch 2 times, most recently from fce7ab1 to ddc956f Compare August 21, 2025 14:51
class HTTPClient(Client):
"""Sync HTTP client for interacting with SoftwareOne Marketplace Platform API."""

def __init__(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems repeating in both classes so could be refactored to a Base Class. I think this is what you did in PR #18?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #18 is about MPTClient, this one is about HTTPClient.

I would like to share that code, but that code is calling different parent depending on if it is a sync or an async client.

I do not know how to implement an init that calls a different parent depending on which "child" you are using, if you know how, please let me know.

Copy link

@jentyk jentyk Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you did it elsewhere, just call super().__init__() with any params if needed of course



@pytest.fixture
def mpt_client_async(api_url, api_token):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a correct name? Shouldn't it be http_client_async? The same above?

@@ -0,0 +1,57 @@
import pytest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering. Maybe, to avoid repetition, since you seem copied the same tests for both clients, you could parametrize tests with sync/async clients?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once are shared, but the important ones we need to use await in the http methods

@albertsola albertsola force-pushed the MPT-12360/async-HTTP-layer-with-Httpx branch from ddc956f to faad310 Compare August 22, 2025 08:22
@sonarqubecloud
Copy link

@albertsola albertsola merged commit 8e98753 into main Aug 22, 2025
3 checks passed
@albertsola albertsola deleted the MPT-12360/async-HTTP-layer-with-Httpx branch August 22, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants