fbratio.py is a small Python script that pulls guest information for a Facebook event, and then determines their gender using first names through calls to the Genderize.io API. Works with Facebook's Graph API, no need to install Chrome extensions or viewing only the "Going" list.
- Install the Facebook SDK for Python under a virtualenv, or your Python libraries.
- Go to Facebook for Developer's Graph API Explorer.
- On the top right of the Graph API Explorer, click on Get Token -> Get User Access Token.
- Check "user_events" under Events, Groups & Pages.
- Click Get Access Token; Facebook will request the appropriate permissions. Facebook needs permissions to retrieve information from the Graph API.
- The User Access Token will appear in the textbox located in the top, copy the token and save for later.
In a terminal window, run the ratio.py with the following line.
python fbratio.py
The program will then ask for the User Access Token and Facebook event identifier. You can get the Facebook event ID from the event URL.
https://www.facebook.com/events/(EventID)/
- -hc: Runs the hardcoded token and event in the header of fbratio.py
- -i [token] [eventid]: Runs the inline arguments instead of prompting
- -g: Prints the names of all guests.
- -n: No call to the Genderize.io API