An unofficial asynchronous Python wrapper for the discord.bio api.
pip install pydiscordbio
- Setting up the client
This will be used to make requests to the API
from pydiscordbio import Client
client = Client()
- Exceptions
Error | Description |
---|---|
pydiscordbio.exceptions.APIError | Raised when the request to the API itself fails |
pydiscordbio.exceptions.NotFound | Raised when the request to the API returns status code 404 |
pydiscordbio.exceptions.UserNotFound | Raised when a user doesn't exist in the API |
pydiscordbio.exceptions.InvalidSearch | Raised when a search query is invalid |
- Getting a user's details, discord info and connections via username or Discord ID
All methods of Client are typed meaning your IDE should auto complete the attributes
user = await client.user("wa")
#or
user = await client.user(738128655145762949)
- Getting a specific value from a user's details, e.g. description or a users banner URL
description = (await client.user("wa")).details.description
banner_url = (await client.user("wa")).details.banner
- Getting a specific value from a user's Discord, e.g. discord ID or username
description = (await client.user("wa")).discord.id
banner_url = (await client.user("wa")).discord.username
- Getting a user's connected website
website = (await client.user("wa")).connections.website
# Discord connections
discord_connections = (await client.user("wa")).connections.discord
# Returns a list of DiscordConnection objects
- Miscellaneous Endpoints
top_users = await client.top()
# Returns a list of PartialUser objects from the top liked profiles
result = await client.search('Adam')
# Returns a list of PartialUser objects from the query
- UserDetails (from client.user)
details: User
discord: Discord
connections: UserConnections
- User
slug: str
user_id: int
flags: int
verified: bool
premium_type: int
created_at: datetime
description: str
location: str
gender: Optional[str]
birthday: Optional[datetime]
email: Optional[str]
occupation: Optional[str]
banner: Optional[str]
premium: bool
staff: bool
likes: int
- Discord
id: int
username: str
full_username: str
avatar: Optional[str]
avatar_url: str
is_avatar_animated: bool
discriminator: str
flags: int
- UserConnections
website: Optional[str]
instagram: Optional[str]
snapchat: Optional[str]
linkedin: Optional[str]
discord: List[DiscordConnection]
- PartialUser
slug: str
verified: bool
staff: bool
premium: bool
likes: int
description: Optional[str]
discord: Discord
- DiscordConnection
connection_type: str
name: str
id: str