Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/xmistt/rebootpy/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The BasicClient class is a stripped-down version of Client designed for simple operations like user lookups and stats fetching. Use this when you don’t need party or friend features.
BasicClient does not support:
  • Parties (except fetch_party())
  • Friends
  • XMPP messaging and most events

Constructor

BasicClient(
    auth: Auth,
    **kwargs
)
auth
Auth
required
The authentication method to use. See Authentication for available methods.
http_connector
aiohttp.BaseConnector
The connector to use for HTTP connection pooling.
http_retry_config
HTTPRetryConfig
Configuration for HTTP retries.
build
str
default:"++Fortnite+Release-38.10-CL-47888945"
The Fortnite build version string.
os
str
default:"Windows/10.0.19045.1.768.64bit"
The OS version string for the user agent.
cache_users
bool
default:"True"
Whether to cache User objects. Disable for programs with many users to reduce memory usage.
kill_other_sessions
bool
default:"True"
Whether to kill other existing sessions/tokens on login.

Attributes

user
ClientUser
The user the client is logged in as.

Supported Events

event_ready
Dispatched when the client is ready.
event_before_start
Dispatched before the client starts.
event_before_close
Dispatched before the client closes.
event_restart
Dispatched when the client restarts.
event_device_auth_generate
Dispatched when device auth is generated.
event_auth_refresh
Dispatched when authentication is refreshed.

Methods

run

client.run()
Starts the event loop and runs the client. This is a blocking method and should be the last function called. Raises:
  • AuthException - Invalid credentials or authentication failure
  • HTTPException - Request error during login

start

await client.start(dispatch_ready: bool = True)
Starts the client and logs in. Can be used as a coroutine or async context manager.
dispatch_ready
bool
default:"True"
Whether to dispatch the ready event when ready.
Returns: StartContext - Can be used as async context manager or awaited. Raises:
  • AuthException - Invalid credentials or authentication failure
  • HTTPException - Request error during login

close

await client.close(
    close_http: bool = True,
    dispatch_close: bool = True
)
Logs out and closes running services.
close_http
bool
default:"True"
Whether to close the HTTP client session.
dispatch_close
bool
default:"True"
Whether to dispatch close events.
Raises:
  • HTTPException - Error during logout

is_closed

client.is_closed() -> bool
Checks if the client is closed.
return
bool
True if closed, else False.

is_ready

client.is_ready() -> bool
Checks if the client’s internal state is ready.
return
bool
True if ready, else False.

wait_until_ready

await client.wait_until_ready()
Waits until the client’s internal state is ready.

wait_until_closed

await client.wait_until_closed()
Waits until the client is fully closed.

restart

await client.restart()
Restarts the client completely. All events received during restart are dispatched when finished. Raises:
  • AuthException - Invalid credentials or authentication failure
  • HTTPException - Request error during login

User Methods

fetch_user

await client.fetch_user(
    user: str,
    cache: bool = False,
    raw: bool = False
) -> Optional[User]
Fetches a user by ID or display name.
user
str
required
User ID or display name.
cache
bool
default:"False"
Whether to check cache before making API request.
raw
bool
default:"False"
Whether to return raw API data instead of User object.
return
Optional[User]
The user if found, else None.
Raises:
  • HTTPException - Request error

fetch_users

await client.fetch_users(
    users: Iterable[str],
    cache: bool = False,
    raw: bool = False
) -> List[User]
Fetches multiple users by IDs or display names.
users
Iterable[str]
required
Iterable of user IDs or display names.
cache
bool
default:"False"
Whether to check cache before making API requests.
raw
bool
default:"False"
Whether to return raw API data.
return
List[User]
List of found users. Missing users are not included.
Raises:
  • HTTPException - Request error

fetch_user_by_display_name

await client.fetch_user_by_display_name(
    display_name: str,
    cache: bool = False,
    raw: bool = False
) -> Optional[User]
Fetches a user by display name.
display_name
str
required
The user’s display name.
cache
bool
default:"False"
Whether to check cache first.
raw
bool
default:"False"
Whether to return raw API data.
return
Optional[User]
The user if found, else None.
Raises:
  • HTTPException - Request error

fetch_users_by_display_name

await client.fetch_users_by_display_name(
    display_name: str,
    raw: bool = False
) -> List[User]
Fetches all users (including external platform accounts) matching a display name.
display_name
str
required
The display name to search for.
raw
bool
default:"False"
Whether to return raw API data.
return
List[User]
List of all matching users.
Raises:
  • HTTPException - Request error

search_users

await client.search_users(
    prefix: str,
    platform: UserSearchPlatform
) -> List[UserSearchEntry]
Searches for users by prefix, returning up to 100 matches.
prefix
str
required
The search prefix (case insensitive).
platform
UserSearchPlatform
required
The platform to search on.
return
List[UserSearchEntry]
Ordered list of matching users.
Raises:
  • HTTPException - Request error

get_user

client.get_user(user_id: str) -> Optional[User]
Gets a user from cache by ID.
user_id
str
required
The user’s ID.
return
Optional[User]
The user if cached, else None.

Stats Methods

fetch_br_stats

await client.fetch_br_stats(
    user_id: str,
    start_time: Optional[DatetimeOrTimestamp] = None,
    end_time: Optional[DatetimeOrTimestamp] = None
) -> StatsV2
Fetches Battle Royale stats for a user.
user_id
str
required
The user’s ID.
start_time
Optional[Union[int, datetime]]
UTC start time (epoch seconds, datetime, or Season.start_timestamp).
end_time
Optional[Union[int, datetime]]
UTC end time (epoch seconds, datetime, or Season.end_timestamp).
return
StatsV2
Stats object for the user.
Raises:
  • Forbidden - User has hidden stats
  • HTTPException - Request error

fetch_ranked_stats

await client.fetch_ranked_stats(
    user_id: str,
    season: Optional[Season] = None
) -> List[CompetitiveRank]
Fetches ranked stats for a user.
user_id
str
required
The user’s ID.
season
Optional[Season]
The season to get ranks for. Defaults to current season.
return
List[CompetitiveRank]
List of all ranks for the season.
Raises:
  • HTTPException - Request error

fetch_multiple_br_stats

await client.fetch_multiple_br_stats(
    user_ids: List[str],
    stats: List[str],
    start_time: Optional[DatetimeOrTimestamp] = None,
    end_time: Optional[DatetimeOrTimestamp] = None
) -> Dict[str, Optional[StatsV2]]
Fetches specific Battle Royale stats for multiple users.
user_ids
List[str]
required
List of user IDs.
stats
List[str]
required
List of stats to fetch. Use StatsV2.create_stat() to create stat strings.
start_time
Optional[Union[int, datetime]]
UTC start time.
end_time
Optional[Union[int, datetime]]
UTC end time.
return
Dict[str, Optional[StatsV2]]
Mapping of user IDs to their stats. Users with private stats are excluded.
Raises:
  • HTTPException - Request error

fetch_battlepass_level

await client.fetch_battlepass_level(
    user_id: str,
    season: Season,
    start_time: Optional[DatetimeOrTimestamp] = None,
    end_time: Optional[DatetimeOrTimestamp] = None
) -> float
Fetches a user’s Battle Pass level.
user_id
str
required
The user’s ID.
season
Season
required
The season to get the level for.
start_time
Optional[Union[int, datetime]]
UTC start time.
end_time
Optional[Union[int, datetime]]
UTC end time.
return
float
Battle Pass level with decimal progress (e.g., 208.63 = Level 208, 63% to 209).
Raises:
  • Forbidden - User has private career board
  • HTTPException - Request error

Friend Management

add_friend

await client.add_friend(user_id: str)
Sends a friend request to a user.
user_id
str
required
The user’s ID.
Raises:
  • NotFound - User does not exist
  • DuplicateFriendship - Already friends
  • FriendshipRequestAlreadySent - Request already pending
  • MaxFriendshipsExceeded - Client hit friendship limit (usually 1000)
  • InviteeMaxFriendshipsExceeded - User hit friendship limit
  • InviteeMaxFriendshipRequestsExceeded - User hit request limit (usually 700)
  • Forbidden - Cannot send request due to user settings
  • HTTPException - Request error

remove_or_decline_friend

await client.remove_or_decline_friend(user_id: str)
Removes a friend or declines a friend request.
user_id
str
required
The user’s ID.
Raises:
  • HTTPException - Request error

block_user

await client.block_user(user_id: str)
Blocks a user.
user_id
str
required
The user’s ID.
Raises:
  • HTTPException - Request error

unblock_user

await client.unblock_user(user_id: str)
Unblocks a user.
user_id
str
required
The user’s ID.
Raises:
  • HTTPException - Request error

fetch_blocklist

await client.fetch_blocklist() -> List[str]
Fetches the client’s blocklist.
return
List[str]
List of blocked user IDs.
Raises:
  • HTTPException - Request error

Event Handling

event

@client.event
async def event_ready():
    print('Client is ready!')

# Or with custom name:
@client.event('ready')
async def my_ready_handler():
    print('Client is ready!')
Decorator to register an event handler. Raises:
  • TypeError - Decorated function is not a coroutine

wait_for

await client.wait_for(
    event: str,
    check: Optional[Callable] = None,
    timeout: Optional[int] = None
) -> Any
Waits for an event to be dispatched.
event
str
required
Event name (without event_ prefix).
check
Optional[Callable]
Predicate function to filter events.
timeout
Optional[int]
Timeout in seconds. None means wait forever.
return
Any
Event arguments (single value, tuple, or None).
Raises:
  • asyncio.TimeoutError - Timeout exceeded

add_event_handler

client.add_event_handler(event: str, coro: Callable)
Registers a coroutine as an event handler.
event
str
required
Event name.
coro
Callable
required
Coroutine function to handle the event.
Raises:
  • TypeError - Function is not a coroutine

remove_event_handler

client.remove_event_handler(event: str, coro: Callable)
Removes a coroutine from event handlers.
event
str
required
Event name.
coro
Callable
required
Coroutine to remove.

Store and News

fetch_item_shop

await client.fetch_item_shop() -> Store
Fetches the current item shop.
return
Store
Object representing the item shop.
Raises:
  • HTTPException - Request error

fetch_br_news

await client.fetch_br_news() -> List[BattleRoyaleNewsPost]
Fetches Battle Royale news posts.
return
List[BattleRoyaleNewsPost]
List of news posts.
Raises:
  • HTTPException - Request error

fetch_br_playlists

await client.fetch_br_playlists() -> List[Playlist]
Fetches all registered playlists (including inactive ones).
return
List[Playlist]
List of all playlists.
Raises:
  • HTTPException - Request error

fetch_party

await client.fetch_party(party_id: str) -> Optional[Party]
Fetches a party by ID.
party_id
str
required
The party’s ID.
return
Optional[Party]
The party if found, else None.
Raises:
  • Forbidden - Not allowed to look up this party
  • HTTPException - Request error

Example

import rebootpy
import asyncio

client = rebootpy.BasicClient(
    auth=rebootpy.DeviceAuth(
        device_id='your_device_id',
        account_id='your_account_id',
        secret='your_secret'
    )
)

@client.event
async def event_ready():
    print(f'Logged in as {client.user.display_name}')
    
    # Fetch user
    user = await client.fetch_user('Ninja')
    if user:
        print(f'Found user: {user.display_name}')
        
        # Fetch stats
        stats = await user.fetch_br_stats()
        print(f'Stats: {stats.get_stats()}')
    
    await client.close()

client.run()

Build docs developers (and LLMs) love