API wrapper for the pronoundb.org API.
Project description
PronounDB Python API
API wrapper for the pronoundb.org API.
Installation
pip install pronoundb
Setup
You need to create a client to be able to use the pronoundb wrapper. Make sure to use a descriptive user agent.
from pronoundb import Client
pronoundb_client = Client(user_agent="Example for Python PronounDB API Wrapper")
Examples
Lookup someone's pronouns by their discord id:
from pronoundb import Client, Platform
pronoundb_client = Client(user_agent="Example for Python PronounDB API Wrapper")
pronoundb_client.get_pronouns_by_platform_ids(Platform.DISCORD, 123456789012345678)
# -> {123456789012345678: ["he", "him"]}
Lookup someone's pronouns by their minecraft (java) uuid:
from pronoundb import Client, Platform
pronoundb_client = Client(user_agent="Example for Python PronounDB API Wrapper")
pronoundb_client.get_pronouns_by_platform_ids(Platform.MINECRAFT, "12345678-1234-1234-1234-123456789012")
# -> {"12345678-1234-1234-1234-123456789012": ["they", "them"]}
Lookup multiple users pronouns by their discord id:
from pronoundb import Client, Platform
pronoundb_client = Client(user_agent="Example for Python PronounDB API Wrapper")
pronoundb_client.get_pronouns_by_platform_ids(Platform.DISCORD, [123456789012345678, 987654321098765432])
# -> {123456789012345678: ["he", "him"], 987654321098765432: ["she", "her"]}
Supported Platforms
- Discord
- GitHub
- Minecraft (Java)
- Twitch
Custom Pronouns (Version 2.0.0)
Beginning with version 2.0.0, you can give the client a list of pronouns to translate them, for example.
from pronoundb import Client, Platform
pronoundb_client = Client(user_agent="Example for Python PronounDB API Wrapper", pronouns={
"unspecified": [],
"he": ["Er", "Ihn"],
"she": ["Sie", "Ihr"],
"it": ["Es", "Seine"],
"they": ["They", "Them"],
"any": ["Jede"],
"other": ["Anderes"],
"ask": ["Frag"],
"avoid": ["Nutz Name"],
})
pronoundb_client.get_pronouns_by_platform_ids(Platform.DISCORD, 123456789012345678)
# -> {123456789012345678: ["Er", "Ihn"]}
You can also use one of the included translation pronouns (english_pronouns
and german_pronouns
).
AND when forgejo supports that, you can contribute translations as well! :D
Notice, that currently in some languages some translations like the "They/Them" are still in active debate about how to translate them, so dear developer: Think about if the way the presets do it is good.
- If it's good, ignore the deprecation warning and use the preset.
- If not, make your own.
Decorations (Version 3.0.0)
Decorations are a new feature of pronoundb and currently in Beta. If you want to use them, you can do that like this:
from pronoundb import Client, Platform
pronoundb_client = Client(user_agent="Example for Python PronounDB API Wrapper")
pronoundb_client.get_decorations_by_platform_ids(Platform.DISCORD, 123456789012345678)
# -> {123456789012345678: "donator_aurora"}
Contributing
Contributions to this library are always welcome and highly encouraged.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pronoundb-3.0.1.tar.gz
.
File metadata
- Download URL: pronoundb-3.0.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.4 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 303611f29c4f05e6256586c6bcc591f1e6d7f2a1d51d0b17430d34479958cad2 |
|
MD5 | 6dc68d3486dc32a8f60ccba2feb679bd |
|
BLAKE2b-256 | 9e1229ebe1e638a662eb8bd3c85c64580a2cb05555e2d2cfcbcc67886e25b562 |
File details
Details for the file pronoundb-3.0.1-py3-none-any.whl
.
File metadata
- Download URL: pronoundb-3.0.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.4 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6a6140e115b1e71ef5bae66b0346e69d90fe473d98ce5064a0c7e210ac35eb6 |
|
MD5 | 29d8191ecbcc1bcbaec7996c09714ba7 |
|
BLAKE2b-256 | b6304862f14a1347b1b211582d6059cc2a548c26007ba04ae85673eb04eb81f3 |