Beat Saver API wrapper
- Rate Limit handling
- Query Caching
- Everything is
async
- Additional helper methods and async generators
- Faker data provider
The faker data mode can be activated with the following beatsaver = BeatSaverAPI(test_mode=True)
.
This will return random data instead of making API requests to Beat Saver.
import asyncio
from pybeatsaver import BeatSaverAPI, BeatSaver
async def main():
async with BeatSaverAPI() as beatsaver:
beatmap = await beatsaver.beatmap("16d22")
print(beatmap)
# Without "async with" syntax
async def main2():
beatsaver = BeatSaver()
await beatsaver.start()
beatmap = await beatsaver.beatmap("16d22")
print(beatmap)
# Get fake data instead
async def main_fake():
async with BeatSaverAPI(test_mode=True) as beatsaver:
beatmap = await beatsaver.beatmap("16d22")
print(beatmap)
asyncio.run(main())
asyncio.run(main2())
asyncio.run(main_fake())
from faker import Faker
from pybeatsaver import BeatSaverProvider
faker = Faker()
faker.add_provider(BeatSaverProvider)
beatmap = faker.map_detail()
print(beatmap)