oxrpy 2.2.0__tar.gz → 2.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {oxrpy-2.2.0 → oxrpy-2.3.0}/MANIFEST.in +2 -0
  2. {oxrpy-2.2.0 → oxrpy-2.3.0}/PKG-INFO +92 -1
  3. oxrpy-2.2.0/oxrpy.egg-info/PKG-INFO → oxrpy-2.3.0/README.md +86 -27
  4. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/__init__.py +6 -1
  5. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/_base.py +2 -0
  6. oxrpy-2.3.0/oxrpy/_signatures.pyi +453 -0
  7. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/aio.py +92 -31
  8. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/client.py +34 -10
  9. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/follower.py +24 -0
  10. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/map.py +2 -1
  11. oxrpy-2.3.0/oxrpy/pool.py +291 -0
  12. oxrpy-2.3.0/oxrpy/state.py +100 -0
  13. oxrpy-2.2.0/README.md → oxrpy-2.3.0/oxrpy.egg-info/PKG-INFO +118 -0
  14. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy.egg-info/SOURCES.txt +2 -0
  15. oxrpy-2.3.0/oxrpy.egg-info/requires.txt +14 -0
  16. {oxrpy-2.2.0 → oxrpy-2.3.0}/pyproject.toml +1 -0
  17. oxrpy-2.2.0/oxrpy/_signatures.pyi +0 -181
  18. oxrpy-2.2.0/oxrpy.egg-info/requires.txt +0 -8
  19. {oxrpy-2.2.0 → oxrpy-2.3.0}/LICENSE +0 -0
  20. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/__main__.py +0 -0
  21. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/_signatures.py +0 -0
  22. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/commands.py +0 -0
  23. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/errors.py +0 -0
  24. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/events.py +0 -0
  25. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/oxrpy.py +0 -0
  26. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/py.typed +0 -0
  27. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/ratelimit.py +0 -0
  28. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/sync.py +0 -0
  29. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy/types.py +0 -0
  30. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy.egg-info/dependency_links.txt +0 -0
  31. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy.egg-info/entry_points.txt +0 -0
  32. {oxrpy-2.2.0 → oxrpy-2.3.0}/oxrpy.egg-info/top_level.txt +0 -0
  33. {oxrpy-2.2.0 → oxrpy-2.3.0}/setup.cfg +0 -0
@@ -2,3 +2,5 @@ prune tests
2
2
  prune examples
3
3
  prune .github
4
4
  prune scripts
5
+ prune docs
6
+ exclude mkdocs.yml
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oxrpy
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: Python wrapper for the Oxford Response private server API
5
5
  Author: BLK-TTAUDI
6
6
  Project-URL: Homepage, https://github.com/BLK-TTAUDI/OXRPY
@@ -23,9 +23,15 @@ Requires-Dist: httpx>=0.24; extra == "async"
23
23
  Provides-Extra: test
24
24
  Requires-Dist: pytest>=7; extra == "test"
25
25
  Requires-Dist: httpx>=0.24; extra == "test"
26
+ Provides-Extra: docs
27
+ Requires-Dist: mkdocs<2,>=1.6; extra == "docs"
28
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
29
+ Requires-Dist: mkdocstrings[python]>=0.26; extra == "docs"
30
+ Requires-Dist: httpx>=0.24; extra == "docs"
26
31
  Dynamic: license-file
27
32
 
28
33
  # oxrpy
34
+ <!-- --8<-- [start:intro] -->
29
35
 
30
36
  A Python wrapper for the [Oxford Response private server API](https://docs.oxfd.re/). Use it to
31
37
  read what's happening on your server and run commands on it from your own bot, website or tool.
@@ -47,6 +53,8 @@ You'll need Python 3.10 or newer.
47
53
  > keep working after that. The data comes back in a different format, though, so check
48
54
  > [the changelog](https://github.com/BLK-TTAUDI/OXRPY/blob/main/CHANGELOG.md) before you upgrade.
49
55
 
56
+ <!-- --8<-- [end:intro] -->
57
+ <!-- --8<-- [start:getting-started] -->
50
58
  ## Getting started
51
59
 
52
60
  You'll need your server's API key. The server owner can find it in **Server Management >
@@ -79,6 +87,8 @@ Keep your key private. Anyone who has it can run commands on your server, change
79
87
  and ban people. Keep it on your own machine or bot, and never put it in website code that
80
88
  people can see.
81
89
 
90
+ <!-- --8<-- [end:getting-started] -->
91
+ <!-- --8<-- [start:reading-data] -->
82
92
  ## Reading data
83
93
 
84
94
  `get_server_data()` lets you ask for any mix of sections in a single request. Section names
@@ -145,6 +155,8 @@ def describe(player: Player) -> str:
145
155
  return f'{player["Username"]} ({player.get("Team")})'
146
156
  ```
147
157
 
158
+ <!-- --8<-- [end:reading-data] -->
159
+ <!-- --8<-- [start:following] -->
148
160
  ## Following logs as they happen
149
161
 
150
162
  `follow()` keeps checking the logs for you and only hands you entries you haven't seen yet,
@@ -175,6 +187,8 @@ The loop keeps going if the internet drops, you get rate limited or the API has
175
187
  It waits a bit longer after each failure in a row (up to a minute) and logs a warning. It only
176
188
  stops for problems that waiting won't fix, like a wrong API key, and raises those.
177
189
 
190
+ <!-- --8<-- [end:following] -->
191
+ <!-- --8<-- [start:events] -->
178
192
  ## Reacting to events
179
193
 
180
194
  If you just want to run some code whenever something happens in game, register a handler with
@@ -231,6 +245,27 @@ get a flood of old kills on startup. Pass `skip_existing=False` if you want them
231
245
  raises, the error is logged and the bot carries on. Call `api.stop()` from a handler, or from
232
246
  another thread, to make `run_forever()` return.
233
247
 
248
+ ### Carrying on after a restart
249
+
250
+ Bots restart: crashes, updates, the host rebooting. Without help, anything that happens while
251
+ your bot is down is missed. Pass `save_to` and oxrpy remembers where it got to, then picks up
252
+ exactly there next time. That includes what happened while the bot was down, as long as the
253
+ logs still hold it (the last 500 kills, 1,000 events and so on).
254
+
255
+ ```python
256
+ api.run_forever(save_to="cursor.json")
257
+
258
+ # or with follow()
259
+ for data, new in api.follow("KillLogs", save_to="cursor.json"):
260
+ ...
261
+ ```
262
+
263
+ The position is saved after your handlers have run for each check, so a crash part-way through
264
+ means those entries come round again rather than being lost. To keep it somewhere other than a
265
+ file, like your bot's database, pass any object with `load()` and `save(state)` methods.
266
+
267
+ <!-- --8<-- [end:events] -->
268
+ <!-- --8<-- [start:commands] -->
234
269
  ## Running commands
235
270
 
236
271
  ```python
@@ -320,6 +355,8 @@ It never touches the owner. `sync_staff` leaves alone any staff you didn't menti
320
355
  pass `remove_others=True`. `sync_group` does remove anyone not in your list, unless you pass
321
356
  `remove_others=False`.
322
357
 
358
+ <!-- --8<-- [end:commands] -->
359
+ <!-- --8<-- [start:map] -->
323
360
  ## Putting things on the map
324
361
 
325
362
  Oxford publishes [a map image](https://docs.oxfd.re/map-march.png) of the whole map.
@@ -338,6 +375,8 @@ distance(player["Position"], vehicle["Position"]) # studs, ignoring heigh
338
375
  nearest(player["Position"], api.get_catalogue()["Map"]["Places"]) # nearest named place
339
376
  ```
340
377
 
378
+ <!-- --8<-- [end:map] -->
379
+ <!-- --8<-- [start:async] -->
341
380
  ## Async (discord.py and friends)
342
381
 
343
382
  `AsyncOxfordAPI` has all the same methods, but you `await` them, so your bot doesn't freeze
@@ -383,6 +422,45 @@ async for ban in api.iter_bans():
383
422
  Use `async with AsyncOxfordAPI(key) as api:`, or call `await api.aclose()` when you're done,
384
423
  to close the connection cleanly.
385
424
 
425
+ <!-- --8<-- [end:async] -->
426
+ <!-- --8<-- [start:many-servers] -->
427
+ ## Many servers in one app
428
+
429
+ If you're building something lots of servers use (a bot, a CAD, a dashboard), each server's
430
+ owner gives your app their server key. `AsyncServerPool` runs one set of handlers across all of
431
+ them:
432
+
433
+ ```python
434
+ from oxrpy import AsyncServerPool
435
+
436
+ pool = AsyncServerPool(app_key=os.environ["OXFD_APP_KEY"]) # app key optional
437
+ pool.add("guild-1234", key_from_guild_1234)
438
+ pool.add("guild-5678", key_from_guild_5678)
439
+
440
+ @pool.on("Kill")
441
+ async def on_kill(server, kill): # the server's name comes first
442
+ await post_to_guild(server, kill)
443
+
444
+ @pool.on("error")
445
+ async def on_error(server, exc):
446
+ print(f"{server}: {exc}")
447
+
448
+ await pool.run_forever(save_dir="positions/")
449
+ ```
450
+
451
+ - With an app key, the pool paces every server's requests together. Your app's limits count
452
+ across all the servers it calls, so separate clients would trip over each other.
453
+ - If an owner regenerates their key, that one server stops being followed. You hear about it
454
+ through your `error` handler and `pool.failed`, and every other server carries on.
455
+ - You can `pool.add()` and `await pool.remove()` servers while it's running, for example when
456
+ someone links or unlinks their server.
457
+ - `pool["guild-1234"]` is that server's normal async client, for reads and commands.
458
+ - `await pool.each(lambda api: api.get_players())` and
459
+ `await pool.run_command_on_all("announce ...")` do something on every server at once.
460
+ - `save_dir` keeps each server's position, so restarts don't miss anything.
461
+
462
+ <!-- --8<-- [end:many-servers] -->
463
+ <!-- --8<-- [start:app-keys] -->
386
464
  ## App keys
387
465
 
388
466
  If you're making something that lots of servers will use, you can ask Oxford Roleplay for an
@@ -393,6 +471,8 @@ server key for whichever server you're talking to:
393
471
  api = OxfordAPI(server_key_for_that_server, app_key=os.environ["OXFD_APP_KEY"])
394
472
  ```
395
473
 
474
+ <!-- --8<-- [end:app-keys] -->
475
+ <!-- --8<-- [start:rate-limits] -->
396
476
  ## Rate limits
397
477
 
398
478
  oxrpy spaces out your requests so you stay under Oxford's limits:
@@ -409,6 +489,8 @@ If you do get rate limited, it waits as long as the API asks and then tries agai
409
489
  The game also has its own limit of 15 commands every 10 seconds per server. Go over it and the
410
490
  extra commands fail with `RATE_LIMITED`.
411
491
 
492
+ <!-- --8<-- [end:rate-limits] -->
493
+ <!-- --8<-- [start:errors] -->
412
494
  ## Errors
413
495
 
414
496
  ```python
@@ -426,6 +508,8 @@ from oxrpy import (
426
508
  Reading data from an offline server doesn't raise an error. `data.online` is `False`, the live
427
509
  sections are `None`, and the logs, bans, staff and settings still work.
428
510
 
511
+ <!-- --8<-- [end:errors] -->
512
+ <!-- --8<-- [start:status] -->
429
513
  ## API status
430
514
 
431
515
  Want to know if the API itself is up?
@@ -434,6 +518,8 @@ Want to know if the API itself is up?
434
518
  api.get_status() # {"Status": "operational", "UptimeSeconds": ..., "LastHour": {...}, "Uptime": {...}}
435
519
  ```
436
520
 
521
+ <!-- --8<-- [end:status] -->
522
+ <!-- --8<-- [start:cli] -->
437
523
  ## From the command line
438
524
 
439
525
  Installing oxrpy also gives you an `oxrpy` command for quick checks:
@@ -447,6 +533,8 @@ oxrpy players # who's in your server
447
533
  `server` and `players` read your key from the `OXFD_SERVER_KEY` environment variable. Add
448
534
  `--json` to any of them to get the raw data.
449
535
 
536
+ <!-- --8<-- [end:cli] -->
537
+ <!-- --8<-- [start:examples] -->
450
538
  ## Examples
451
539
 
452
540
  The [examples folder](https://github.com/BLK-TTAUDI/OXRPY/tree/main/examples) has scripts you
@@ -462,6 +550,9 @@ can copy and run:
462
550
  - [sync_staff_from_list.py](https://github.com/BLK-TTAUDI/OXRPY/blob/main/examples/sync_staff_from_list.py)
463
551
  keeps staff ranks matching a list, and shows you the changes before making them.
464
552
 
553
+ <!-- --8<-- [end:examples] -->
554
+ <!-- --8<-- [start:license] -->
465
555
  ## License
466
556
 
467
557
  Proprietary. See the [LICENSE](https://github.com/BLK-TTAUDI/OXRPY/blob/main/LICENSE) file.
558
+ <!-- --8<-- [end:license] -->
@@ -1,31 +1,5 @@
1
- Metadata-Version: 2.4
2
- Name: oxrpy
3
- Version: 2.2.0
4
- Summary: Python wrapper for the Oxford Response private server API
5
- Author: BLK-TTAUDI
6
- Project-URL: Homepage, https://github.com/BLK-TTAUDI/OXRPY
7
- Project-URL: Repository, https://github.com/BLK-TTAUDI/OXRPY
8
- Project-URL: Documentation, https://docs.oxfd.re/
9
- Project-URL: Changelog, https://github.com/BLK-TTAUDI/OXRPY/blob/main/CHANGELOG.md
10
- Keywords: oxford response,oxford roleplay,roblox,api,wrapper
11
- Classifier: Development Status :: 5 - Production/Stable
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3 :: Only
14
- Classifier: License :: Other/Proprietary License
15
- Classifier: Operating System :: OS Independent
16
- Classifier: Typing :: Typed
17
- Requires-Python: >=3.10
18
- Description-Content-Type: text/markdown
19
- License-File: LICENSE
20
- Requires-Dist: requests>=2.25
21
- Provides-Extra: async
22
- Requires-Dist: httpx>=0.24; extra == "async"
23
- Provides-Extra: test
24
- Requires-Dist: pytest>=7; extra == "test"
25
- Requires-Dist: httpx>=0.24; extra == "test"
26
- Dynamic: license-file
27
-
28
1
  # oxrpy
2
+ <!-- --8<-- [start:intro] -->
29
3
 
30
4
  A Python wrapper for the [Oxford Response private server API](https://docs.oxfd.re/). Use it to
31
5
  read what's happening on your server and run commands on it from your own bot, website or tool.
@@ -47,6 +21,8 @@ You'll need Python 3.10 or newer.
47
21
  > keep working after that. The data comes back in a different format, though, so check
48
22
  > [the changelog](https://github.com/BLK-TTAUDI/OXRPY/blob/main/CHANGELOG.md) before you upgrade.
49
23
 
24
+ <!-- --8<-- [end:intro] -->
25
+ <!-- --8<-- [start:getting-started] -->
50
26
  ## Getting started
51
27
 
52
28
  You'll need your server's API key. The server owner can find it in **Server Management >
@@ -79,6 +55,8 @@ Keep your key private. Anyone who has it can run commands on your server, change
79
55
  and ban people. Keep it on your own machine or bot, and never put it in website code that
80
56
  people can see.
81
57
 
58
+ <!-- --8<-- [end:getting-started] -->
59
+ <!-- --8<-- [start:reading-data] -->
82
60
  ## Reading data
83
61
 
84
62
  `get_server_data()` lets you ask for any mix of sections in a single request. Section names
@@ -145,6 +123,8 @@ def describe(player: Player) -> str:
145
123
  return f'{player["Username"]} ({player.get("Team")})'
146
124
  ```
147
125
 
126
+ <!-- --8<-- [end:reading-data] -->
127
+ <!-- --8<-- [start:following] -->
148
128
  ## Following logs as they happen
149
129
 
150
130
  `follow()` keeps checking the logs for you and only hands you entries you haven't seen yet,
@@ -175,6 +155,8 @@ The loop keeps going if the internet drops, you get rate limited or the API has
175
155
  It waits a bit longer after each failure in a row (up to a minute) and logs a warning. It only
176
156
  stops for problems that waiting won't fix, like a wrong API key, and raises those.
177
157
 
158
+ <!-- --8<-- [end:following] -->
159
+ <!-- --8<-- [start:events] -->
178
160
  ## Reacting to events
179
161
 
180
162
  If you just want to run some code whenever something happens in game, register a handler with
@@ -231,6 +213,27 @@ get a flood of old kills on startup. Pass `skip_existing=False` if you want them
231
213
  raises, the error is logged and the bot carries on. Call `api.stop()` from a handler, or from
232
214
  another thread, to make `run_forever()` return.
233
215
 
216
+ ### Carrying on after a restart
217
+
218
+ Bots restart: crashes, updates, the host rebooting. Without help, anything that happens while
219
+ your bot is down is missed. Pass `save_to` and oxrpy remembers where it got to, then picks up
220
+ exactly there next time. That includes what happened while the bot was down, as long as the
221
+ logs still hold it (the last 500 kills, 1,000 events and so on).
222
+
223
+ ```python
224
+ api.run_forever(save_to="cursor.json")
225
+
226
+ # or with follow()
227
+ for data, new in api.follow("KillLogs", save_to="cursor.json"):
228
+ ...
229
+ ```
230
+
231
+ The position is saved after your handlers have run for each check, so a crash part-way through
232
+ means those entries come round again rather than being lost. To keep it somewhere other than a
233
+ file, like your bot's database, pass any object with `load()` and `save(state)` methods.
234
+
235
+ <!-- --8<-- [end:events] -->
236
+ <!-- --8<-- [start:commands] -->
234
237
  ## Running commands
235
238
 
236
239
  ```python
@@ -320,6 +323,8 @@ It never touches the owner. `sync_staff` leaves alone any staff you didn't menti
320
323
  pass `remove_others=True`. `sync_group` does remove anyone not in your list, unless you pass
321
324
  `remove_others=False`.
322
325
 
326
+ <!-- --8<-- [end:commands] -->
327
+ <!-- --8<-- [start:map] -->
323
328
  ## Putting things on the map
324
329
 
325
330
  Oxford publishes [a map image](https://docs.oxfd.re/map-march.png) of the whole map.
@@ -338,6 +343,8 @@ distance(player["Position"], vehicle["Position"]) # studs, ignoring heigh
338
343
  nearest(player["Position"], api.get_catalogue()["Map"]["Places"]) # nearest named place
339
344
  ```
340
345
 
346
+ <!-- --8<-- [end:map] -->
347
+ <!-- --8<-- [start:async] -->
341
348
  ## Async (discord.py and friends)
342
349
 
343
350
  `AsyncOxfordAPI` has all the same methods, but you `await` them, so your bot doesn't freeze
@@ -383,6 +390,45 @@ async for ban in api.iter_bans():
383
390
  Use `async with AsyncOxfordAPI(key) as api:`, or call `await api.aclose()` when you're done,
384
391
  to close the connection cleanly.
385
392
 
393
+ <!-- --8<-- [end:async] -->
394
+ <!-- --8<-- [start:many-servers] -->
395
+ ## Many servers in one app
396
+
397
+ If you're building something lots of servers use (a bot, a CAD, a dashboard), each server's
398
+ owner gives your app their server key. `AsyncServerPool` runs one set of handlers across all of
399
+ them:
400
+
401
+ ```python
402
+ from oxrpy import AsyncServerPool
403
+
404
+ pool = AsyncServerPool(app_key=os.environ["OXFD_APP_KEY"]) # app key optional
405
+ pool.add("guild-1234", key_from_guild_1234)
406
+ pool.add("guild-5678", key_from_guild_5678)
407
+
408
+ @pool.on("Kill")
409
+ async def on_kill(server, kill): # the server's name comes first
410
+ await post_to_guild(server, kill)
411
+
412
+ @pool.on("error")
413
+ async def on_error(server, exc):
414
+ print(f"{server}: {exc}")
415
+
416
+ await pool.run_forever(save_dir="positions/")
417
+ ```
418
+
419
+ - With an app key, the pool paces every server's requests together. Your app's limits count
420
+ across all the servers it calls, so separate clients would trip over each other.
421
+ - If an owner regenerates their key, that one server stops being followed. You hear about it
422
+ through your `error` handler and `pool.failed`, and every other server carries on.
423
+ - You can `pool.add()` and `await pool.remove()` servers while it's running, for example when
424
+ someone links or unlinks their server.
425
+ - `pool["guild-1234"]` is that server's normal async client, for reads and commands.
426
+ - `await pool.each(lambda api: api.get_players())` and
427
+ `await pool.run_command_on_all("announce ...")` do something on every server at once.
428
+ - `save_dir` keeps each server's position, so restarts don't miss anything.
429
+
430
+ <!-- --8<-- [end:many-servers] -->
431
+ <!-- --8<-- [start:app-keys] -->
386
432
  ## App keys
387
433
 
388
434
  If you're making something that lots of servers will use, you can ask Oxford Roleplay for an
@@ -393,6 +439,8 @@ server key for whichever server you're talking to:
393
439
  api = OxfordAPI(server_key_for_that_server, app_key=os.environ["OXFD_APP_KEY"])
394
440
  ```
395
441
 
442
+ <!-- --8<-- [end:app-keys] -->
443
+ <!-- --8<-- [start:rate-limits] -->
396
444
  ## Rate limits
397
445
 
398
446
  oxrpy spaces out your requests so you stay under Oxford's limits:
@@ -409,6 +457,8 @@ If you do get rate limited, it waits as long as the API asks and then tries agai
409
457
  The game also has its own limit of 15 commands every 10 seconds per server. Go over it and the
410
458
  extra commands fail with `RATE_LIMITED`.
411
459
 
460
+ <!-- --8<-- [end:rate-limits] -->
461
+ <!-- --8<-- [start:errors] -->
412
462
  ## Errors
413
463
 
414
464
  ```python
@@ -426,6 +476,8 @@ from oxrpy import (
426
476
  Reading data from an offline server doesn't raise an error. `data.online` is `False`, the live
427
477
  sections are `None`, and the logs, bans, staff and settings still work.
428
478
 
479
+ <!-- --8<-- [end:errors] -->
480
+ <!-- --8<-- [start:status] -->
429
481
  ## API status
430
482
 
431
483
  Want to know if the API itself is up?
@@ -434,6 +486,8 @@ Want to know if the API itself is up?
434
486
  api.get_status() # {"Status": "operational", "UptimeSeconds": ..., "LastHour": {...}, "Uptime": {...}}
435
487
  ```
436
488
 
489
+ <!-- --8<-- [end:status] -->
490
+ <!-- --8<-- [start:cli] -->
437
491
  ## From the command line
438
492
 
439
493
  Installing oxrpy also gives you an `oxrpy` command for quick checks:
@@ -447,6 +501,8 @@ oxrpy players # who's in your server
447
501
  `server` and `players` read your key from the `OXFD_SERVER_KEY` environment variable. Add
448
502
  `--json` to any of them to get the raw data.
449
503
 
504
+ <!-- --8<-- [end:cli] -->
505
+ <!-- --8<-- [start:examples] -->
450
506
  ## Examples
451
507
 
452
508
  The [examples folder](https://github.com/BLK-TTAUDI/OXRPY/tree/main/examples) has scripts you
@@ -462,6 +518,9 @@ can copy and run:
462
518
  - [sync_staff_from_list.py](https://github.com/BLK-TTAUDI/OXRPY/blob/main/examples/sync_staff_from_list.py)
463
519
  keeps staff ranks matching a list, and shows you the changes before making them.
464
520
 
521
+ <!-- --8<-- [end:examples] -->
522
+ <!-- --8<-- [start:license] -->
465
523
  ## License
466
524
 
467
525
  Proprietary. See the [LICENSE](https://github.com/BLK-TTAUDI/OXRPY/blob/main/LICENSE) file.
526
+ <!-- --8<-- [end:license] -->
@@ -1,6 +1,6 @@
1
1
  """oxrpy: a Python wrapper for the Oxford Response private server API (https://docs.oxfd.re)."""
2
2
 
3
- __version__ = "2.2.0"
3
+ __version__ = "2.3.0"
4
4
 
5
5
  from ._base import ( # noqa: E402
6
6
  AUDIT_CATEGORIES,
@@ -26,11 +26,16 @@ from .errors import ( # noqa: E402
26
26
  ServerOfflineError,
27
27
  )
28
28
  from .follower import LogFollower # noqa: E402
29
+ from .pool import AsyncServerPool # noqa: E402
30
+ from .state import FileState, StateStore # noqa: E402
29
31
  from .ratelimit import AsyncTokenBucket, TokenBucket # noqa: E402
30
32
 
31
33
  __all__ = [
32
34
  "OxfordAPI",
33
35
  "AsyncOxfordAPI",
36
+ "AsyncServerPool",
37
+ "FileState",
38
+ "StateStore",
34
39
  "ServerData",
35
40
  "LogFollower",
36
41
  "AsyncLogFollower",
@@ -195,6 +195,8 @@ class BaseClient(CommandHelpers):
195
195
  self._limiters = self._make_limiters(rate_limit)
196
196
  self._handlers = Handlers()
197
197
  self._catalogue_cache: Optional[Tuple[float, Any]] = None
198
+ # An extra limit shared with other clients (AsyncServerPool sets it: 30/s per IP).
199
+ self._ip_bucket: Any = None
198
200
 
199
201
  # ------------------------------------------------------------------ rate limits
200
202