Official Python SDK for GenderAPI.io
Project description
genderapi-python
Official Python SDK for GenderAPI.io — determine gender from names, emails, and usernames using AI.
🚀 Installation
Install the required package:
pip install requests
(If not published on PyPI yet, clone the repo and install manually.)
📝 Usage
🔹 Get Gender by Name
from genderapi import GenderAPI
api = GenderAPI("YOUR_API_KEY")
result = api.get_gender_by_name(name="Michael")
print(result)
🔹 Get Gender by Email
result = api.get_gender_by_email(email="michael.smith@example.com")
print(result)
🔹 Get Gender by Username
result = api.get_gender_by_username(username="michael_dev")
print(result)
📥 API Parameters
Name Lookup
| Parameter | Required | Description |
|---|---|---|
| name | Yes | Name to query |
| country | No | 2-letter country code (e.g. "US") |
Email Lookup
| Parameter | Required | Description |
|---|---|---|
| Yes | Email address to query | |
| country | No | 2-letter country code (e.g. "US") |
Username Lookup
| Parameter | Required | Description |
|---|---|---|
| username | Yes | Username to query |
| country | No | 2-letter country code (e.g. "US") |
✅ API Response
Example JSON response for all endpoints:
{
"status": true,
"used_credits": 1,
"remaining_credits": 4999,
"expires": 1743659200,
"q": "michael.smith@example.com",
"name": "Michael",
"gender": "male",
"country": "US",
"total_names": 325,
"probability": 98,
"duration": "4ms"
}
Response Fields
| Field | Type | Description |
|---|---|---|
| status | Boolean | true or false. Check errors if false. |
| used_credits | Integer | Credits used for this request. |
| remaining_credits | Integer | Remaining credits on your package. |
| expires | Integer (timestamp) | Package expiration date (in seconds). |
| q | String | Your input query (name, email, or username). |
| name | String | Found name. |
| gender | Enum[String] | "male", "female", or "null". |
| country | Enum[String] | Most likely country (e.g. "US", "DE", etc.). |
| total_names | Integer | Number of samples behind the prediction. |
| probability | Integer | Likelihood percentage (50-100). |
| duration | String | Processing time (e.g. "4ms"). |
⚠️ Error Codes
When status is false, check the following error codes:
| errno | errmsg | Description |
|---|---|---|
| 50 | access denied | Unauthorized IP Address or Referrer. Check your access privileges. |
| 90 | invalid country code | Check supported country codes. ISO 3166-1 alpha-2 |
| 91 | name not set || email not set | Missing name or email parameter on your request. |
| 92 | too many names || too many emails | Limit is 100 for names, 50 for emails in one request. |
| 93 | limit reached | The API key credit has been finished. |
| 94 | invalid or missing key | The API key cannot be found. |
| 99 | API key has expired | Please renew your API key. |
Example error response:
{
"status": false,
"errno": 94,
"errmsg": "invalid or missing key"
}
⚖️ License
MIT License
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file genderapi-1.0.0.tar.gz.
File metadata
- Download URL: genderapi-1.0.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcd5224e9daa37545115010634a1cd5b1c2549a91cdd899c2988dae9078c731a
|
|
| MD5 |
cf5b69ea80a8c4b4b735f25ec040deb5
|
|
| BLAKE2b-256 |
ca4c4984224f0f6e56f2883bbb80e97ba8ea53b905cf5b0e1b367f23bdd9d816
|
Provenance
The following attestation bundles were made for genderapi-1.0.0.tar.gz:
Publisher:
publish-to-pypi.yml on GenderAPI/genderapi-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
genderapi-1.0.0.tar.gz -
Subject digest:
fcd5224e9daa37545115010634a1cd5b1c2549a91cdd899c2988dae9078c731a - Sigstore transparency entry: 259558575
- Sigstore integration time:
-
Permalink:
GenderAPI/genderapi-python@1926d1d57cec1b5f62a8edf909d62d9e32a3f92d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/GenderAPI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@1926d1d57cec1b5f62a8edf909d62d9e32a3f92d -
Trigger Event:
push
-
Statement type:
File details
Details for the file genderapi-1.0.0-py3-none-any.whl.
File metadata
- Download URL: genderapi-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
653615dfd19969bf009fdd4d1701e5f8945793f150d705db7d33b73c166ccc98
|
|
| MD5 |
b12a875d170e9347a75200f35f2904bb
|
|
| BLAKE2b-256 |
194ffe049fa0e2d0ef82408255b4a4e221583507a9830de9fb3e07dd2e8029f8
|
Provenance
The following attestation bundles were made for genderapi-1.0.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on GenderAPI/genderapi-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
genderapi-1.0.0-py3-none-any.whl -
Subject digest:
653615dfd19969bf009fdd4d1701e5f8945793f150d705db7d33b73c166ccc98 - Sigstore transparency entry: 259558580
- Sigstore integration time:
-
Permalink:
GenderAPI/genderapi-python@1926d1d57cec1b5f62a8edf909d62d9e32a3f92d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/GenderAPI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@1926d1d57cec1b5f62a8edf909d62d9e32a3f92d -
Trigger Event:
push
-
Statement type: