API Wrapper Documentation:
InterceptHandler
Bases: Handler
Intercepts the logs from SocketIO, EngineIO, and urllib and sends them to the logger
Source code in src/ogsapi/client.py
emit(record)
Parse the log and emit to the logger
Source code in src/ogsapi/client.py
OGSClient
Connect to and interact with the OGS REST API and SocketIO API.
Examples:
>>> from ogsapi.client import OGSClient
>>> ogs = OGSClient(
client_id=client_id,
client_secret=client_secret,
username=username,
password=password,
)
Connecting to Websocket
Connected to socket, authenticating
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client_id |
str
|
Client ID from OGS |
required |
client_secret |
str
|
Client Secret from OGS |
required |
username |
str
|
Username of OGS account |
required |
password |
str
|
Password of OGS account |
required |
dev |
bool
|
Use the development API. Defaults to False. |
False
|
Attributes:
Name | Type | Description |
---|---|---|
credentials |
OGSCredentials
|
Credentials object containing all credentials |
api |
OGSRestAPI
|
REST API connection to OGS |
sock |
OGSSocket
|
SocketIO connection to OGS |
Source code in src/ogsapi/client.py
60 61 62 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 99 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 139 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 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 194 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 232 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 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
|
accept_challenge(challenge_id)
Accept a challenge.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
challenge_id |
str
|
ID of the challenge to accept. |
required |
Returns:
Name | Type | Description |
---|---|---|
response |
dict
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
active_games(player_id=None)
Get the user's active games.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
player_id |
int
|
ID of player whos active games we want to retrieve. |
None
|
Returns:
Name | Type | Description |
---|---|---|
response |
list[dict]
|
JSON object containing players active games. |
Source code in src/ogsapi/client.py
challenge_details(challenge_id)
Get details of a challenge.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
challenge_id |
str
|
ID of the challenge to get details of. |
required |
Returns:
Name | Type | Description |
---|---|---|
response |
dict
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
create_challenge(player_username=None, **game_settings)
Create either an open challenge or a challenge to a specific player. The time control settings are built depending on which time control is used. Make sure that you pass the correct time control settings for the time control you want to use. The other time control settings will be ignored.
Examples:
>>> ogs.create_challenge(player_username='test', main_time=300, byoyomi_time=30, byoyomi_stones=5)
Challenging player: test - 1234567
(20328495, 53331333)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
player_username |
str
|
Username of the player to challenge. If used will issue the challenge to the player. Defaults to None. |
None
|
Other Parameters:
Name | Type | Description |
---|---|---|
min_rank |
int
|
Minimum rank of the player to challenge. Defaults to 7. |
max_rank |
int
|
Maximum rank of the player to challenge. Defaults to 18. |
challenger_color |
str
|
Color of the challenger. Defaults to 'white'. |
aga_ranked |
bool
|
Whether or not the game is AGA ranked. Defaults to False. |
invite_only |
bool
|
Whether or not the game is invite only. Defaults to False. |
game_name |
str
|
Name of the game. Defaults to 'Friendly Game'. |
game_rules |
str
|
Rules of the game. Defaults to 'japanese'. |
game_ranked |
bool
|
Whether or not the game is ranked. Defaults to False. |
game_width |
int
|
Width of the board. Defaults to 19. |
game_height |
int
|
Height of the board. Defaults to 19. |
game_handicap |
int
|
Handicap of the game. Defaults to 0. |
game_komi_auto |
bool
|
Whether or not to use automatic komi. Defaults to True. |
game_komi |
float
|
Komi of the game. Defaults to 6.5. Not needed if using auto komi. |
game_disable_analysis |
bool
|
Whether or not to disable analysis. Defaults to False. |
game_initial_state |
str
|
Initial state of the game. Defaults to None. |
game_private |
bool
|
Whether or not the game is private. Defaults to False. |
game_time_control |
str
|
Time control of the game. Defaults to 'byoyomi'. |
byoyomi_main_time |
int
|
Main time of the game in seconds. Defaults to 2400. only used if byoyomi time control is used. |
byoyomi_period_time |
int
|
Period time of the game in seconds. Defaults to 30. only used if byoyomi time control is used. |
byoyomi_periods |
int
|
Number of periods in the game. Defaults to 5. only used if byoyomi time control is used. |
byoyomi_periods_min |
int
|
Minimum periods of the game. Defaults to 5. only used if byoyomi time control is used. |
byoyomi_periods_max |
int
|
Maximum periods of the game. Defaults to 5. only used if byoyomi time control is used. |
fischer_time_initial_time |
int
|
Initial time of the game in seconds. Defaults to 900. only used if fischer time control is used. |
fischer_time_increment |
int
|
Increment of the game in seconds. Defaults to 0. only used if fischer time control is used. |
fischer_time_max_time |
int
|
Maximum time of the game in seconds. Defaults to 1800. only used if fischer time control is used. |
Returns:
Name | Type | Description |
---|---|---|
challenge_id |
int
|
ID of the challenge created |
game_id |
int
|
ID of the game created |
Source code in src/ogsapi/client.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
|
decline_challenge(challenge_id)
Decline a challenge.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
challenge_id |
str
|
ID of the challenge to decline. |
required |
Returns:
Name | Type | Description |
---|---|---|
response |
dict
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
disable_logging()
enable_logging()
game_details(game_id)
Get details of a game.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
game_id |
str
|
ID of the game to get details of. |
required |
Returns:
Name | Type | Description |
---|---|---|
response |
dict
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
game_png(game_id)
Get PNG of a game.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
game_id |
str
|
ID of the game to get PNG of. |
required |
Returns:
Name | Type | Description |
---|---|---|
response |
bytes
|
PNG image of the game |
Source code in src/ogsapi/client.py
game_reviews(game_id)
Get reviews of a game.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
game_id |
str
|
ID of the game to get reviews of. |
required |
Returns:
Name | Type | Description |
---|---|---|
response |
dict
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
game_sgf(game_id)
Get SGF of a game.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
game_id |
str
|
ID of the game to get SGF of. |
required |
Returns:
Name | Type | Description |
---|---|---|
response |
str
|
SGF of the game |
Source code in src/ogsapi/client.py
get_player(player_username)
Get a player by username.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
player_username |
str
|
Username of the player to get. |
required |
Returns:
Name | Type | Description |
---|---|---|
player_data |
dict
|
Player data returned from the endpoint |
Source code in src/ogsapi/client.py
get_player_games(player_username)
Get a player's games by username.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
player_username |
str
|
Username of the player to get games of. |
required |
Returns:
Name | Type | Description |
---|---|---|
player_games |
dict
|
Player games returned from the endpoint |
Source code in src/ogsapi/client.py
received_challenges()
Get all received challenges.
Returns:
Name | Type | Description |
---|---|---|
challenges |
list[dict]
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
remove_friend(username)
Remove a friend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
username |
str
|
Username of the user to remove as a friend. |
required |
Returns:
Name | Type | Description |
---|---|---|
response |
dict
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
send_friend_request(username)
Send a friend request to a user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
username |
str
|
Username of the user to send a friend request to. |
required |
Returns:
Name | Type | Description |
---|---|---|
response |
dict
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
sent_challenges()
Get all sent challenges.
Returns:
Name | Type | Description |
---|---|---|
challenges |
list[dict]
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
socket_connect(callback_handler)
Connect to the socket.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback_handler |
Callable
|
Callback function to send socket events to. |
required |
Source code in src/ogsapi/client.py
socket_disconnect()
Disconnect from the socket. You will need to do this before exiting your program, Or else it will hang and require a keyboard interrupt.
update_user_settings(username=None, first_name=None, last_name=None, private_name=None, country=None, website=None, about=None)
Update the user's settings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
username |
str
|
New username. Defaults to None. |
None
|
first_name |
str
|
New first name. Defaults to None. |
None
|
last_name |
str
|
New last name. Defaults to None. |
None
|
private_name |
bool
|
Whether or not to make the name private. Defaults to None. |
None
|
country |
str
|
New country. Defaults to None. |
None
|
website |
str
|
New website. Defaults to None. |
None
|
about |
str
|
New about. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
response |
dict
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
user_friends(username=None)
Get the user's friends.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
username |
str
|
Username of the user to get friends of. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
response |
dict
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
user_games(page=1, page_size=10)
Get the user's games.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page |
int
|
Page number of user games. Defaults to page 1 |
1
|
page_size |
int
|
Number of games per page. Defaults to 10 |
10
|
Returns:
Name | Type | Description |
---|---|---|
response |
dict
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
user_settings()
Get the user's settings.
Returns:
Name | Type | Description |
---|---|---|
response |
dict
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
user_vitals()
Get the user's vitals.
Returns:
Name | Type | Description |
---|---|---|
response |
dict
|
JSON response from the endpoint |
Source code in src/ogsapi/client.py
OGSRestAPI
OGS Rest API Class for handling REST connections to OGS
Parameters:
Name | Type | Description | Default |
---|---|---|---|
credentials |
OGSCredentials
|
The credentials to use for authentication |
required |
dev |
bool
|
Whether to connect to beta OGS instance. Defaults to False. |
False
|
Attributes:
Name | Type | Description |
---|---|---|
credentials |
OGSCredentials
|
The credentials used for authentication |
api_ver |
str
|
The API version to use |
base_url |
str
|
The base URL to use for API calls |
Source code in src/ogsapi/ogsrestapi.py
21 22 23 24 25 26 27 28 29 30 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 62 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 99 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 |
|
authenticate()
Authenticate with the OGS API and save the access token and user ID.
Source code in src/ogsapi/ogsrestapi.py
call_rest_endpoint(method, endpoint, params=None, payload=None)
Make a request to the OGS REST API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method |
str
|
HTTP method to use. Accepts GET, POST, PUT, DELETE |
required |
endpoint |
str
|
Endpoint to make request to |
required |
params |
dict
|
Parameters to pass to the endpoint. Defaults to None. |
None
|
payload |
dict
|
Payload to pass to the endpoint. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
response |
Callable
|
Returns the request response |
Source code in src/ogsapi/ogsrestapi.py
get_auth_data()
Get the auth data from the OGS API and save it to the credentials object for use in the socket connection.
Source code in src/ogsapi/ogsrestapi.py
OGSGame
OGSGame class for handling games connected via the OGSSocket.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
game_socket |
OGSSocket
|
OGSSocket object to connect to the game. |
required |
game_id |
str
|
ID of the game to connect to. |
required |
credentials |
OGSCredentials
|
OGSCredentials object containing tokens for authentication to the Socket |
required |
callback_handler |
Callable
|
Callback handler function to send events to the user. |
required |
Attributes:
Name | Type | Description |
---|---|---|
socket |
OGSSocket
|
OGSSocket object to connect to the game. |
game_data |
OGSGameData
|
OGSGameData object containing game data. |
credentials |
OGSCredentials
|
OGSCredentials object containing tokens for authentication to the Socket |
callback_handler |
Callable
|
Callback handler function to send events to the user. |
callback_func |
dict
|
Dictionary containing the callback functions. |
Source code in src/ogsapi/ogsgame.py
23 24 25 26 27 28 29 30 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 62 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 99 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 139 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 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 194 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 |
|
accept_undo(move)
Accept an undo request on the game
Parameters:
Name | Type | Description | Default |
---|---|---|---|
move |
int
|
The move number to accept the undo at. |
required |
Source code in src/ogsapi/ogsgame.py
cancel()
Cancel the game if within the first few moves
Source code in src/ogsapi/ogsgame.py
cancel_undo(move)
Cancel an undo request on the game
Parameters:
Name | Type | Description | Default |
---|---|---|---|
move |
int
|
The move number to accept the undo at. |
required |
Source code in src/ogsapi/ogsgame.py
connect()
Connect to the game
disconnect()
get_gamedata()
move(move)
Submit a move to the game
Parameters:
Name | Type | Description | Default |
---|---|---|---|
move |
str
|
The move to submit to the game. Accepts GTP format. |
required |
Examples:
Source code in src/ogsapi/ogsgame.py
pass_turn()
Pass the turn in the game
Source code in src/ogsapi/ogsgame.py
pause()
resign()
resume()
send_chat(message, chat_type, move)
Send a chat message to the game
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
The message to send to the game. |
required |
type |
str
|
The type of message to send. Accepts 'main', 'malkovich', 'hidden', or 'personal' |
required |
move |
int
|
The move number to send the message at. |
required |
Examples:
Source code in src/ogsapi/ogsgame.py
undo(move)
Request an undo on the game
Parameters:
Name | Type | Description | Default |
---|---|---|---|
move |
int
|
The move number to accept the undo at. |
required |
Source code in src/ogsapi/ogsgame.py
OGSSocket
OGS Socket Class for handling SocketIO connections to OGS
Parameters:
Name | Type | Description | Default |
---|---|---|---|
credentials |
OGSCredentials
|
OGSCredentials object containing tokens for authentication to the Socket |
required |
debug |
bool
|
Enable debug logging. Defaults to False. |
required |
Attributes:
Name | Type | Description |
---|---|---|
clock_drift |
float
|
The clock drift of the socket |
clock_latency |
float
|
The clock latency of the socket |
last_ping |
int
|
The last ping time of the socket |
last_issued_ping |
int
|
The last time a ping was issued |
games |
dict[OGSGame]
|
A dict of connected game objects |
client_callbacks |
dict
|
A dict of socket level callbacks |
credentials |
OGSCredentials
|
OGSCredentials object containing tokens for authentication to the Socket |
socket |
Client
|
The socketio client object |
Source code in src/ogsapi/ogssocket.py
24 25 26 27 28 29 30 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 62 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 99 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 139 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 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 194 195 196 197 |
|
chat_connect()
Connect to the chat socket
Source code in src/ogsapi/ogssocket.py
connect()
Connect to the socket
Source code in src/ogsapi/ogssocket.py
disable_logging()
disconnect()
enable_logging()
game_connect(game_id, callback_handler=None)
Connect to a game
Parameters:
Name | Type | Description | Default |
---|---|---|---|
game_id |
int
|
The id of the game to connect to |
required |
callback_handler |
Callable
|
The callback handler for the game. Defaults to the callback_handler of the socket. |
None
|
Returns:
Name | Type | Description |
---|---|---|
OGSGame |
OGSGame
|
The game object |
Source code in src/ogsapi/ogssocket.py
game_disconnect(game_id)
Disconnect from a game
Parameters:
Name | Type | Description | Default |
---|---|---|---|
game_id |
int
|
The id of the game to disconnect from |
required |
host_info()
notification_connect()
Connect to the notification socket
Source code in src/ogsapi/ogssocket.py
ping()
socket_callbacks()
Set the callback functions for the socket
Source code in src/ogsapi/ogssocket.py
OGSCredentials
dataclass
OGS REST API Credentials dataclass
Attributes:
Name | Type | Description |
---|---|---|
client_id |
str
|
OGS Client ID |
client_secret |
str
|
OGS Client Secret |
username |
str
|
Case sensitive OGS Username |
password |
str
|
OGS Password |
access_token |
str
|
Access token to use for authentication. Defaults to None. |
refresh_token |
str
|
The refresh token to use for authentication. Defaults to None. |
user_id |
str
|
The user ID to use for authentication. Defaults to None. |
chat_auth |
str
|
The chat auth token to use for authentication. Defaults to None. |
user_jwt |
str
|
The user JWT to use for authentication. Defaults to None. |
notification_auth |
str
|
The notification auth token to use for authentication. Defaults to None. |
Source code in src/ogsapi/ogscredentials.py
OGSGameData
dataclass
OGS Game Dataclass
Attributes:
Name | Type | Description |
---|---|---|
game_id |
int
|
ID of the game. |
game_name |
str
|
Name of the game. |
private |
bool
|
Whether the game is private or not. |
white_player |
Player
|
Player object containing information about the white player. |
black_player |
Player
|
Player object containing information about the black player. |
ranked |
bool
|
Whether the game is ranked or not. |
handicap |
int
|
Handicap of the game. |
komi |
float
|
Komi of the game. |
width |
int
|
Width of the board. |
height |
int
|
Height of the board. |
rules |
str
|
Ruleset of the game. EX: "japanese", "chinese", "aga" |
time_control |
dict
|
Dictionary containing information about the time control. |
phase |
str
|
Phase of the game. |
move_list |
list[str]
|
List of moves in the game. |
initial_state |
dict
|
Initial state of the game. |
start_time |
int
|
Start time of the game. |
clock |
dict
|
Dictionary containing the clock data. |
latency |
int
|
Latency of the game. |
Source code in src/ogsapi/ogsgamedata.py
update(new_values)
Update the game data with new values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_values |
dict
|
Dictionary containing the new values to update the game data with. |
required |
Source code in src/ogsapi/ogsgamedata.py
Player
dataclass
OGS Player Dataclass
Attributes:
Name | Type | Description |
---|---|---|
username |
str
|
Username of the player. |
rank |
str
|
Rank of the player. |
professional |
bool
|
Whether the player is a professional or not. |
id |
int
|
ID of the player. |
Source code in src/ogsapi/ogsgamedata.py
update(new_values)
Update the player data with new values
TimeControl
dataclass
OGS Time Control Dataclass
Attributes:
Name | Type | Description |
---|---|---|
system |
str
|
Timecontrol system used in the game. EX: "byoyomi", "fischer" |
time_control |
str
|
Time control used in the game. EX: "simple", "absolute", "canadian" |
speed |
str
|
Speed of the game. EX: "correspondence", "live" |
pause_on_weekends |
bool
|
Whether the game pauses on weekends or not. |
time_increment |
int
|
Time added to the clock after each move. |
initial_time |
int
|
Initial time on the clock. |
max_time |
int
|
Maximum time on the clock. |
Source code in src/ogsapi/ogsgamedata.py
update(new_values)
Update the player data with new values
ByoyomiTime
dataclass
OGS Byoyomi Time Data
Attributes:
Name | Type | Description |
---|---|---|
thinking_time |
int
|
Main time left on the clock. |
periods |
int
|
Number of periods left. |
period_time |
int
|
Time of each period. |
Source code in src/ogsapi/ogsgameclock.py
update(new_values)
Update the Byoyomi time data with new values
FischerTime
dataclass
OGS Fischer Time Data
Attributes:
Name | Type | Description |
---|---|---|
thinking_time |
int
|
Time left on the clock. |
increment |
int
|
Time added to the clock after each move. |
Source code in src/ogsapi/ogsgameclock.py
update(new_values)
Update the Fischer time data with new values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_values |
dict
|
New values to update the Fischer time data with. |
required |
Source code in src/ogsapi/ogsgameclock.py
OGSGameClock
dataclass
OGS Game Clock Dataclass
Attributes:
Name | Type | Description |
---|---|---|
system |
str
|
Timecontrol system used in the game. EX: "byoyomi", "fischer" |
current_player |
str
|
Which players turn is it |
last_move |
str
|
Last move made in the game. |
expiration |
int
|
Time when the game will expire. |
received |
int
|
Time when the game clock data was received. |
latency_when_received |
int
|
Latency when the game clock data was received. |
white_time |
ByoyomiTime or FischerTime
|
White players time control data |
black_time |
ByoyomiTime or FischerTime
|
Black players time control data |
Source code in src/ogsapi/ogsgameclock.py
set_timecontrol()
Set the time control attributes based on the time control system
Source code in src/ogsapi/ogsgameclock.py
update(new_values)
Update the game clock data with new values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_values |
dict
|
New values to update the game clock data with. |
required |