Skip to content

Commit fdb392b

Browse files
authored
Update kagglesdk to the latest (#855)
1 parent 5343896 commit fdb392b

File tree

7 files changed

+792
-59
lines changed

7 files changed

+792
-59
lines changed

src/kagglesdk/competitions/types/search_competitions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class SearchCompetitionsRole(enum.Enum):
1818
SEARCH_COMPETITIONS_ROLE_PARTICIPANT = 2
1919
SEARCH_COMPETITIONS_ROLE_PARTICIPANT_ONLY = 3
2020
"""Excludes competitions user hosted, even if they are also a participant"""
21+
SEARCH_COMPETITIONS_ROLE_JUDGE = 4
2122

2223
class SearchCompetitionsStatus(enum.Enum):
2324
SEARCH_COMPETITIONS_STATUS_ANY = 0

src/kagglesdk/discussions/types/search_discussions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class SearchDiscussionsSourceType(enum.Enum):
1919
SEARCH_DISCUSSIONS_SOURCE_TYPE_COMPETITION_SOLUTION = 6
2020
SEARCH_DISCUSSIONS_SOURCE_TYPE_MODEL = 7
2121
SEARCH_DISCUSSIONS_SOURCE_TYPE_WRITE_UP = 8
22+
SEARCH_DISCUSSIONS_SOURCE_TYPE_LEARN_TRACK = 9
2223

2324
class SearchDiscussionsTopicType(enum.Enum):
2425
SEARCH_DISCUSSIONS_TOPIC_TYPE_UNSPECIFIED = 0

src/kagglesdk/kaggle_http_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,7 @@ def _try_fill_auth(self):
255255
self._signed_in = False
256256

257257
def _get_request_url(self, service_name: str, request_name: str):
258-
return f"{self._endpoint}/v1/{service_name}/{request_name}"
258+
# On prod, API endpoints are served under https://api.kaggle.com/v1,
259+
# but on staging/admin/local, they are served under http://localhost/api/v1.
260+
base_url = self._endpoint if self._env == KaggleEnv.PROD else f"{self._endpoint}/api"
261+
return f"{base_url}/v1/{service_name}/{request_name}"

src/kagglesdk/security/services/oauth_service.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from kagglesdk.common.types.http_redirect import HttpRedirect
22
from kagglesdk.kaggle_http_client import KaggleHttpClient
3-
from kagglesdk.security.types.oauth_service import ExchangeOAuthTokenRequest, ExchangeOAuthTokenResponse, IntrospectTokenRequest, IntrospectTokenResponse, StartOAuthFlowRequest
3+
from kagglesdk.security.types.oauth_service import ExchangeOAuthTokenRequest, ExchangeOAuthTokenResponse, IntrospectTokenRequest, IntrospectTokenResponse, RegisterOAuthClientRequest, RegisterOAuthClientResponse, StartOAuthFlowRequest
44

55
class OAuthClient(object):
66

@@ -42,3 +42,17 @@ def introspect_token(self, request: IntrospectTokenRequest = None) -> Introspect
4242
request = IntrospectTokenRequest()
4343

4444
return self._client.call("security.OAuthService", "IntrospectToken", request, IntrospectTokenResponse)
45+
46+
def register_oauth_client(self, request: RegisterOAuthClientRequest = None) -> RegisterOAuthClientResponse:
47+
r"""
48+
Dynamic Client Registration Endpoint (RFC 7591)
49+
50+
Args:
51+
request (RegisterOAuthClientRequest):
52+
The request object; initialized to empty instance if not specified.
53+
"""
54+
55+
if request is None:
56+
request = RegisterOAuthClientRequest()
57+
58+
return self._client.call("security.OAuthService", "RegisterOAuthClient", request, RegisterOAuthClientResponse)

0 commit comments

Comments
 (0)