/propublica-nonprofit

Python client for the ProPublica NonProfit Explorer API.

Primary LanguagePythonMIT LicenseMIT

Propublica Nonprofit Explorer Client

[forked from: https://github.com/robrem/propublica-nonprofit][https://github.com/robrem/propublica-nonprofit]

Python client for the ProPublica NonProfit Explorer API.

Query data on over 1.6 million nonprofit organizations. No API key is required, but please refer to ProPublica's terms of use.

Changed to work with Python 3+ syntax only.

Usage

>>> from nonprofit import Nonprofit
>>> np = Nonprofit()

# get organization by employer identification number (EIN)
>>> org = np.orgs.get('521275227')
>>> org['name']
'CENTER FOR RESPONSIVE POLITICS'

# get organizations by keyword
>>> orgs = np.search.get(q='responsive')
>>> orgs[0]['name']
'RESPONSIVE EDUCATION SOLUTIONS'

# get organizations by state
>>> orgs = np.search.get(state='WA')
>>> orgs[0]['name']
'101 CLUB'

# query by multiple parameters (q, state, c_code, ntee)
>>> orgs = np.search.get(c_code=2, ntee=7)
>>> orgs[0]['name']
'1800 MASSACHUSETTS AVENUE CORP'

# use fetch to access endpoints directly
>>> orgs = np.fetch('search.json?q=delta')
>>> orgs['total_results']
2543

# optionally use a custom lambda to parse results
>>> orgs = np.fetch('search.json?q=delta', lambda orgs: orgs['organizations'][5])
>>> orgs['name']
'DELTA DELTA DELTA CORP'

[]: https://github.com/robrem/propublica-nonprofit