codingame_tools.client.service.services.puzzle¶
puzzle
¶
Async Puzzle service endpoint.
CgPuzzleServiceHelper
¶
CgPuzzleServiceHelper(service)
Bases: CgServiceHelper['CgPuzzleService']
Helper methods for CgPuzzleService. Currently empty.
Source code in codingame_tools/client/service/cg_service.py
124 125 | |
CgPuzzleService
¶
CgPuzzleService(client)
Bases: CgService
Async Puzzle service endpoint.
Source code in codingame_tools/client/service/services/puzzle.py
33 34 35 | |
count_solved_puzzles_by_programming_language
async
¶
count_solved_puzzles_by_programming_language(codingamer_id=None)
Count a codingamer's solved puzzles, broken down by programming language.
Parameters:
-
codingamer_id(int | None, default:None) –The codingamer whose solved-puzzle counts to list. If not provided, defaults to the logged-in codingamer's ID.
Returns:
-
list[CgSolvedPuzzlesByLanguage]–A list of CgSolvedPuzzlesByLanguage objects.
Raises:
-
CgAuthenticationError–If the session is not authenticated and cannot implicitly login, or if
codingamer_idis not provided and no codingamer ID can be resolved from the session's credentials. -
CgClientHttpError–If a transport error occurs, if the response content could not be decoded at all, if the status code is not 2xx, or if the decoded content is not a list.
Source code in codingame_tools/client/service/services/puzzle.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
find_puzzle_of_the_week
async
¶
find_puzzle_of_the_week()
Find the current puzzle of the week.
Returns:
-
CgPuzzleOfTheWeek–A CgPuzzleOfTheWeek object.
Raises:
-
CgAuthenticationError–If the session is not authenticated and cannot implicitly login.
-
CgClientHttpError–If a transport error occurs, if the response content could not be decoded at all, if the status code is not 2xx, or if the decoded content is not a dict.
Source code in codingame_tools/client/service/services/puzzle.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
find_all_minimal_progress
async
¶
find_all_minimal_progress(codingamer_id=None)
Find a codingamer's minimal progress summary for every puzzle they have some
relationship to (not just solved/attempted ones--see CgPuzzleMinimalProgress).
Parameters:
-
codingamer_id(int | None, default:None) –The codingamer whose puzzle progress to list. If not provided, defaults to the logged-in codingamer's ID.
Returns:
-
list[CgPuzzleMinimalProgress]–A list of CgPuzzleMinimalProgress objects.
Raises:
-
CgAuthenticationError–If the session is not authenticated and cannot implicitly login, or if
codingamer_idis not provided and no codingamer ID can be resolved from the session's credentials. -
CgClientHttpError–If a transport error occurs, if the response content could not be decoded at all, if the status code is not 2xx, or if the decoded content is not a list.
Source code in codingame_tools/client/service/services/puzzle.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
find_progress_by_ids
async
¶
find_progress_by_ids(puzzle_ids, codingamer_id=None, arg3=2)
Find a codingamer's progress summary for a specific set of puzzles, by puzzle ID.
arg3's purpose is unclear: only 1 and 2 have been observed to return real data
(both return the identical full result set, in the same order); every other value
tried (0, 3, 4, 5, 6, 10, 100) silently returned an empty list rather than erroring.
Defaults to 2, matching observed real usage.
Parameters:
-
puzzle_ids(list[int]) –Numeric puzzle IDs to look up (e.g.
CgLastActivityPuzzle.id,CgPuzzleMinimalProgress.id). -
codingamer_id(int | None, default:None) –The codingamer whose progress to look up. If not provided, defaults to the logged-in codingamer's ID.
-
arg3(int, default:2) –Third positional argument to the underlying findProgressByIds API call. Purpose unclear; see above. Defaults to 2.
Returns:
-
list[CgLastActivityPuzzle]–A list of CgLastActivityPuzzle objects.
Raises:
-
CgAuthenticationError–If the session is not authenticated and cannot implicitly login, or if
codingamer_idis not provided and no codingamer ID can be resolved from the session's credentials. -
CgClientHttpError–If a transport error occurs, if the response content could not be decoded at all, if the status code is not 2xx, or if the decoded content is not a list.
Source code in codingame_tools/client/service/services/puzzle.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
find_best_following_progress
async
¶
find_best_following_progress(puzzle_id, codingamer_id=None)
Find the best progress on a given puzzle among the codingamers a codingamer follows.
Returns an empty list if none of the followed codingamer(s) have attempted the
puzzle. Only a single followed codingamer has been observed in testing, so it's
unconfirmed whether more than one entry can be returned, or how "best" is determined
among them--see CgFollowingPuzzleProgress.
Parameters:
-
puzzle_id(int) –Numeric ID of the puzzle to check.
-
codingamer_id(int | None, default:None) –The codingamer whose followees to check. If not provided, defaults to the logged-in codingamer's ID.
Returns:
-
list[CgFollowingPuzzleProgress]–A list of CgFollowingPuzzleProgress objects.
Raises:
-
CgAuthenticationError–If the session is not authenticated and cannot implicitly login, or if
codingamer_idis not provided and no codingamer ID can be resolved from the session's credentials. -
CgClientHttpError–If a transport error occurs, if the response content could not be decoded at all, if the status code is not 2xx, or if the decoded content is not a list.
Source code in codingame_tools/client/service/services/puzzle.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
find_progress_by_pretty_id
async
¶
find_progress_by_pretty_id(pretty_id, codingamer_id=None)
Find a codingamer's progress summary for a single puzzle, by its pretty ID (the displayed puzzle title, lowercased with spaces replaced by hyphens--e.g. "literary-alfabet-soupe" for "Literary Alfabet Soupe").
The richest of the three findProgress* methods: uniquely among them, this one also
populates linked_achievements/moderators/statement/title_map.
Parameters:
-
pretty_id(str) –The puzzle's pretty ID (see
CgLastActivityPuzzle.pretty_id). -
codingamer_id(int | None, default:None) –The codingamer whose progress to look up. If not provided, defaults to the logged-in codingamer's ID.
Returns:
-
CgLastActivityPuzzle–A CgLastActivityPuzzle object.
Raises:
-
CgAuthenticationError–If the session is not authenticated and cannot implicitly login, or if
codingamer_idis not provided and no codingamer ID can be resolved from the session's credentials. -
CgClientHttpError–If a transport error occurs, if the response content could not be decoded at all, if the status code is not 2xx, or if the decoded content is not a dict.
Source code in codingame_tools/client/service/services/puzzle.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
generate_session_from_puzzle_pretty_id
async
¶
generate_session_from_puzzle_pretty_id(puzzle_pretty_id, codingamer_id=None, arg3=False)
Get (or create) the codingamer's test session handle for a puzzle, by the puzzle's
pretty ID (e.g. "literary-alfabet-soupe"--see CgTestSessionPuzzle.pretty_id).
This is the API that resolves "which puzzle" into "which test session" before calling
TestSession/startTestSession--i.e. the entry point for solving a puzzle by pretty ID
rather than already having a test_session_handle in hand (e.g. from
CgLastActivityPuzzle). Confirmed live (2026-07-30) to return the same handle across
repeated calls for the same codingamer/puzzle--i.e. a per-user singleton test session,
safely reusable/cacheable rather than needing to be re-derived on every use.
arg3's purpose is unknown; only observed as False.
Parameters:
-
puzzle_pretty_id(str) –The puzzle's pretty ID/slug.
-
codingamer_id(int | None, default:None) –The codingamer to get/create the session for. If not provided, defaults to the logged-in codingamer's ID.
-
arg3(bool, default:False) –Third positional argument to the underlying API call. Purpose unknown; defaults to False.
Returns:
-
str–The test session handle (see
CgTestSessionService.start_test_session).
Raises:
-
CgAuthenticationError–If the session is not authenticated and cannot implicitly login, or if
codingamer_idis not provided and no codingamer ID can be resolved from the session's credentials. -
CgClientHttpError–If a transport error occurs, if the response content could not be decoded at all, if the status code is not 2xx, or if the decoded content is not a dict.
Source code in codingame_tools/client/service/services/puzzle.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |