Client for Genderize.io web service.
Project description
Basic usage
Import the Genderize class and call its get method with a list of names.
from genderize import Genderize print(Genderize().get(['James', 'Eva', 'Thunderhorse']))
[{u'count': 1037, u'gender': u'male', u'name': u'James', u'probability': 0.99}, {u'count': 234, u'gender': u'female', u'name': u'Eva', u'probability': 1.0}, {u'gender': None, u'name': u'Thunderhorse'}]
Shell usage
If run as a script, takes a list of names on stdin, and prints them with their genders.
echo "James\nEva\nThunderhorse" | python -m genderize
James: male Eva: female Thunderhorse: None
Advanced usage
Create a Genderize instance with a custom user agent, an API key, and a shorter timeout than the default 30 seconds. Note that you’ll need to use your own API key or this example won’t work.
from genderize import Genderize genderize = Genderize( user_agent='GenderizeDocs/0.0', api_key='example_api_key', timeout=5.0) print(genderize.get(['James', 'Eva', 'Thunderhorse']))
[{u'count': 1037, u'gender': u'male', u'name': u'James', u'probability': 0.99}, {u'count': 234, u'gender': u'female', u'name': u'Eva', u'probability': 1.0}, {u'gender': None, u'name': u'Thunderhorse'}]
Maintenance
Setup for local development:
virtualenv --prompt '(genderize) ' venv -p python3 pip install -r requirements.txt pip install -r requirements-dev.txt
Release checklist:
- Generate a new version number: major.minor.micro. It should be compatible with both PEP 440 and SemVer 2.0.0.
- Update __version__ in genderize/__init__.py. This is read by setup.py and doesn’t need to be changed there.
- Add a changelog entry and date for the new version in CHANGES.rst.
- Commit the changes. This may be done as part of another change.
- Tag the commit with git tag major.minor.micro.
- Push the tag to GitHub with git push origin major.minor.micro.
- Travis will create a new PyPI release from the tag.
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
Genderize-0.3.1.tar.gz
(6.2 kB
view hashes)
Built Distribution
Close
Hashes for Genderize-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4552b17bf26a5ffae2c29c11bfd0f75a48ab6a834fb6073458c16bcdb6a5ef0 |
|
MD5 | dc5f635d4344829a4a2a4304ad7bb705 |
|
BLAKE2-256 | d922d287d4b6599b3247631a7dcd4ae6e440338b73f9836182b74c33e1b7261e |