codingame_tools.client.service.services.featured_event¶
featured_event
¶
Async FeaturedEvent service endpoint.
CgFeaturedEventServiceHelper
¶
CgFeaturedEventServiceHelper(service)
Bases: CgServiceHelper['CgFeaturedEventService']
Helper methods for CgFeaturedEventService. Currently empty.
Source code in codingame_tools/client/service/cg_service.py
124 125 | |
CgFeaturedEventService
¶
CgFeaturedEventService(client)
Bases: CgService
Async FeaturedEvent service endpoint.
Source code in codingame_tools/client/service/services/featured_event.py
27 28 29 | |
find_upcoming_and_ongoing_featured_events
async
¶
find_upcoming_and_ongoing_featured_events(codingamer_id=None)
Find upcoming and ongoing site-wide featured events (e.g. scheduled Clash of Code or puzzle events), and whether the given codingamer is registered for each.
Parameters:
-
codingamer_id(int | None, default:None) –The codingamer to check registration status for. If not provided, defaults to the logged-in codingamer's ID.
Returns:
-
list[CgFeaturedEvent]–A list of CgFeaturedEvent 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/featured_event.py
31 32 33 34 35 36 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 | |
is_codingamer_auto_registered
async
¶
is_codingamer_auto_registered(codingamer_id=None)
Check whether a codingamer is auto-registered for featured events (e.g. an account setting that opts them into upcoming Clash of Code/puzzle events automatically).
This is a personal setting: passing a codingamer_id other than your own logged-in
ID is rejected by the server with a 403 (invalidUser: You are not authorized to
perform this operation).
Parameters:
-
codingamer_id(int | None, default:None) –The codingamer to check. Must be the logged-in codingamer's own ID (server-enforced; see above). If not provided, defaults to the logged-in codingamer's ID.
Returns:
-
bool–True if the codingamer is auto-registered, False otherwise.
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 (e.g. 403 if
codingamer_idis not your own), or if the decoded content is not a bool.
Source code in codingame_tools/client/service/services/featured_event.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
find_new_featured_event_count
async
¶
find_new_featured_event_count(since=None)
Count featured events published since a given point in time.
since is sent to the server as a bare epoch-millis integer, like every other
epoch-millis argument in this API. CodinGame's own web client has been observed
sending it as a quoted (string-encoded) number instead--both encodings were tested
empirically and the server accepts either, so the simpler bare-int form is used here.
Also confirmed empirically: passing a timestamp before a known featured event's
publish_time counts it towards the result; passing one at or after does not.
This value has not been observed being returned by any other endpoint (e.g. as a stored "last checked" marker)--callers are expected to track their own reference point (e.g. "now", or whenever they last called this).
Parameters:
-
since(datetime | None, default:None) –Count featured events published after this point in time. If not provided, defaults to now (which will always yield 0--callers interested in a nonzero count should track their own reference point, e.g. the last time they called this). Naive datetimes are interpreted as local time (matching Python's own
datetime.timestamp()behavior).
Returns:
-
int–The number of featured events published since
since.
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 an int.
Source code in codingame_tools/client/service/services/featured_event.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
find_clash_slots
async
¶
find_clash_slots(featured_event_id)
Find the individual scheduled Clash of Code slots belonging to a featured event.
featured_event_id is CgFeaturedEvent.id (not CgFeaturedEvent.handle)--e.g. for
a CgFeaturedEvent with handle == "4725bc5cbd6926ec69e31fd542cd0b354738", id
is 4725, the (coincidental-looking) numeric prefix of the handle.
Parameters:
-
featured_event_id(int) –The
idof a "CLASH_OF_CODE"-typeCgFeaturedEvent.
Returns:
-
list[CgClashSlot]–A list of CgClashSlot objects.
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 list.
Source code in codingame_tools/client/service/services/featured_event.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
find_by_handle
async
¶
find_by_handle(handle)
Find a featured event by its opaque handle.
Unlike findUpcomingAndOngoingFeaturedEvents, this endpoint has no codingamer context,
so the returned CgFeaturedEvent.registered is always None here.
Parameters:
-
handle(str) –The featured event's opaque handle (
CgFeaturedEvent.handle).
Returns:
-
CgFeaturedEvent–A CgFeaturedEvent 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/featured_event.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |