Skip to content

feat: add OpenEdxClient for Studio home endpoints - #4

Open
Faraz32123 wants to merge 4 commits into
masterfrom
feat/sdk_working_implementation
Open

feat: add OpenEdxClient for Studio home endpoints#4
Faraz32123 wants to merge 4 commits into
masterfrom
feat/sdk_working_implementation

Conversation

@Faraz32123

@Faraz32123 Faraz32123 commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

@Faraz32123 Faraz32123 self-assigned this Jun 1, 2026
@Faraz32123
Faraz32123 marked this pull request as draft June 1, 2026 13:17
@Faraz32123
Faraz32123 force-pushed the feat/sdk_working_implementation branch 11 times, most recently from 82d9a8b to 02db066 Compare June 3, 2026 11:31
Add OpenEdxClient for Studio home/courses V4 endpoint
@Faraz32123
Faraz32123 force-pushed the feat/sdk_working_implementation branch 2 times, most recently from daeb9f9 to 625eac4 Compare June 3, 2026 11:39
Add OpenEdxClient for Studio home V3 endpoint
@Faraz32123
Faraz32123 force-pushed the feat/sdk_working_implementation branch from 625eac4 to eb83442 Compare June 3, 2026 11:43
@Faraz32123
Faraz32123 force-pushed the feat/sdk_working_implementation branch from c7c095d to 55e3b91 Compare June 3, 2026 11:52
@Faraz32123
Faraz32123 marked this pull request as ready for review June 3, 2026 11:53
Comment thread openedx_sdk/resources/base.py Outdated
Comment on lines +15 to +17
if not response.ok:
raise ApiError(response.status_code, response.text)
return response.json()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Maybe we could wrap this in try-except

Comment thread openedx_sdk/client.py Outdated
Comment on lines +74 to +76
def _request_with_timeout(self, method, url, **kwargs):
kwargs.setdefault("timeout", self._timeout)
return requests.Session.request(self._session, method, url, **kwargs)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

instead of patching session like this maybe we can use subclass to override request object. It will support future updates as well better.

class _TimeoutSession(requests.Session):
    def __init__(self, timeout):
        super().__init__()
        self._timeout = timeout
    def request(self, method, url, **kwargs):
        kwargs.setdefault("timeout", self._timeout)
        return super().request(method, url, **kwargs)

Comment thread openedx_sdk/auth.py Outdated

def __call__(self, r):
"""Attach the JWT Authorization header to the request."""
r.headers["Authorization"] = f"JWT {self._get_token()}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

maybe use token_type for more robustness and default to JWT prefix if not available

Comment thread openedx_sdk/client.py Outdated
Comment on lines +10 to +11
from .resources.home.v3 import HomeResourceV3
from .resources.home.v4 import HomeResourceV4

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

client.py imports HomeResourceV3 / V4 directly from resources.home.v3 / v4; resources/init.py also re-exports them with all. We should either route everything through resources/init.py or remove the re-export.

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.

2 participants