{ "info": { "author": "Nicholas A. Lourie", "author_email": "developer.nick@kozbox.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7" ], "description": "django-charitychecker\n=====================\n\nA django app for verifying U.S. nonprofits by their EIN number. For a\ngeneral python module with similar functionality, check out\n`charitycheck `__.\n\nVisit the\n`github `__.\n\nInstallation:\n=============\n\nFrom pip:\n\n::\n\n pip install django-charitychecker\n\nIn your settings.py:\n\n.. code:: python\n\n INSTALLED_APPS = (\n ...\n charitychecker\n ...\n )\n\nNote that if you want django-charitychecker to work properly, you'll\nneed to periodically fetch data from the IRS to update your local\ndatabase.\n\nUseage:\n=======\n\ndjango-charitychecker only checks U.S. based nonprofits, this means that\nit will not verify foreign nonprofits registered with the IRS (there are\na few, but the data entry format for these organizations is inconsistent\nand so can't be machine parsed easily).\n\ndjango-charitychecker makes the following functions and models public:\n\nPublic Objects and Methods\n--------------------------\n\nModels\n~~~~~~\n\n``charitychecker.IRSNonprofitData``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\na model representing a nonprofit with the following fields:\n\nAttributes\n''''''''''\n\n- ``IRSNonprofitData.ein``: a string representing the nonprofit's EIN\n number.\n\n- ``IRSNonprofitData.name``: a string representing the name of the\n Nonprofit as published in IRS Publication 78.\n\n- ``IRSNonprofitData.city``: a string representing the city in which\n the nonprofit is incorporated.\n\n- ``IRSNonprofitData.state``: a string representing the state in which\n the nonprofit is incorporated.\n\n- ``IRSNonprofitData.country``: a string representing the country in\n which the nonprofit is incorporated.\n\n- ``IRSNonprofitData.deductability_code``: the tax deductability code\n of the nonprofit organization. See the\n `charitycheck `__ README\n for more information on deductability codes.\n\nOf course, you can retrieve a nonprofit's info using their EIN by\n``IRSNonprofitData.objects.get(ein=\"some ein string\")``.\n\nMethods\n'''''''\n\n- ``IRSNonprofitData.verify_nonprofit(ein, name=None, city=None, state=None, country=None, deductability_code=None)``:\n return true if there is a nonprofit in the charitychecker database\n with information matching the information provided to the function as\n arguments, return false otherwise.\n\n- ``IRSNonprofitData.get_deductability_code(ein, name=None, city=None, state=None, country=None)``:\n if a nonprofit is found in the charitychecker database with\n information matching the information provided as arguments to the\n function, then return that nonprofit's deductability code, otherwise\n return the empty string.\n\nUtilities\n~~~~~~~~~\n\n``ignore_blank_space``\n^^^^^^^^^^^^^^^^^^^^^^\n\nA function which takes an iterator (it's meant for file like objects but\nshould take any iterator returning strings), and returns that iterator\nskipping all blank lines and stripping all white space from the end of\nany line.\n\n``open_zip_from_url``\n^^^^^^^^^^^^^^^^^^^^^\n\nA context manager taking two arguments, ``zip_url`` and ``file_name``.\nThe context manager downloads the file from ``zip_url``, attempts to\nunzip and then return the file at the path ``file_name`` from the\ndownloaded zip archive. It does all of this in memory without writing to\ndisk.\n\n``irs_nonprofit_data_context_manager``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nA context manager for dealing with the IRS Publication 78 data. It\nautomatically downloads, unzips, and opens the file from the IRS\nwebsite, closing the resources when finished. It skips any ``FORGN``\nregistered nonprofits, and returns all of the nonprofit data strings as\na generator. Use is as you would any context manager:\n\n::\n\n with IRSNonprofitDataContextManager() as irs_data:\n # code using irs_data as a file object\n .... \n\nThe Publication 78 file is a series of lines of the form\n``ein|name|city|state|country|deductability_code``.\n\n``update_database_from_file``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nA function that takes ``file_manager``, ``convert_line``, ``pk_field``,\nand ``model`` arguments, then uses a file to update in bulk your\napplication's database. Specifically, it takes:\n\n- ``file_manager``: a context manager which returns a generator\n yielding strings. Conceptually, we think of this iterator as a file\n like object, but any generator should work.\n- ``convert_line``: a function whose input is a line yielded by\n ``file_manager`` and that outputs a dictionary mapping keys which are\n field names of ``model`` and values which will be used to instantiate\n those field names.\n- ``pk_field``: The name field which is defined to be the primary key\n on ``model``. This field should not be an ``AutoField`` for the\n following reasons: 1.) bulk updating commands in Django do not call\n the save method on the model, and thus do not set ``AutoField``\n primary keys, 2.) if you are updating your database from some\n third-party source data, you want to be able to identify each line in\n the third-party data uniquely, thus some primary-key like\n value/unique identifier should already exist in your source data.\n Using an ``AutoField`` instead would mean that the function would\n have no way of distinguishing new data and old data that's been\n updated.\n- ``model``: the model you want to update.\n\nNote! This function will delete any data that is in your database and\nnot present in the source file provided by ``file_manager``.\n\n``update_charitychecker_data``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nA function that, when called, downloads a fresh copy of the IRS\nPublication 78 data, unzips it, and uses it to update the charitychecker\ndatabase. It accepts no arguments.\n\nManagement Commands\n~~~~~~~~~~~~~~~~~~~\n\n``update_charitychecker_data``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nA command that downloads a new copy of the IRS Publication 78 data,\nunzips it, and uses the data to update the charitychecker database.\n\nThis command takes no arguments, and only the default django command\noptions. Run it by typing into the command prompt:\n\n``python manage.py update_charitychecker_data``\n\nOf course, you can only run the command after charitychecker is\ninstalled into your project's ``settings.py`` file's ``INSTALLED_APPS``,\nand you've run ``python manage.py syncdb``. This command could take a\nlong time to finish, because it checks that your entire nonprofit\ndatabase (800,000+ rows) is up to date.\n\nTesting\n=======\n\nTest the app as you would any other Django app. In a project with\ncharitychecker installed run:\n\n::\n\n python manage.py test charitychecker\n\nNote that since the test suite tests downloading and unzipping the data\nfrom the IRS, the test suite can take a minute or so, if you want to\nspeed up the tests simply skip the tests using\n``irs_nonprofit_data_context_manager`` and the test suite should run\nmuch faster.\n\nContributing\n============\n\nPull requests are welcome. Also check out\n`charitycheck `__ for a\ngeneral python equivalent of this package if you are interested in\ncontributing.\n\nSuggestions for contributing:\n\n- python 3 support\n- incorporate this module into a larger family of modules/packages\n dealing with nonprofit data (but of course, following the UNIX\n philosophy is really important here. Do one thing and do it well!)\n- writing tests for the ``open_zip_from_url`` and\n ``update_database_from_file`` functions which currently are only\n tested indirectly by the tests on\n ``irs_nonprofit_data_context_manager`` and\n ``update_charitychecker_data``, which are both wrappers for these\n more general functions.\n- add tests for the newly added string methods on the IRSNonprofitData\n model.\n\nAuthors\n=======\n\nAuthored by Nicholas A. Lourie. You can contact him at\ndeveloper.nick@kozbox.com.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nalourie/django-charitychecker", "keywords": "nonprofit nonprofits EIN IRS django", "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "django-charitychecker", "package_url": "https://pypi.org/project/django-charitychecker/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-charitychecker/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/nalourie/django-charitychecker" }, "release_url": "https://pypi.org/project/django-charitychecker/1.3/", "requires_dist": null, "requires_python": null, "summary": "a small django app to verify information about nonprofits using their EINs", "version": "1.3" }, "last_serial": 1292310, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "026f7befd24674785c2e35d09d24ee59", "sha256": "3e5292505f332f3f577a7655bcb0245446671003a41bf328452cfe1c492c387c" }, "downloads": -1, "filename": "django-charitychecker-1.0.zip", "has_sig": false, "md5_digest": "026f7befd24674785c2e35d09d24ee59", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16852, "upload_time": "2014-10-26T05:16:04", "url": "https://files.pythonhosted.org/packages/7f/2b/b8609c4ea7e42a635c4c38d9afc4782930fa3aedee3630bd0ea87da1152c/django-charitychecker-1.0.zip" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "9345e207215e39042159d92a335a1cfa", "sha256": "410ba2e7e11d8ff727bf184da3f6e23c723a222ad93f9af510bdd969480c64c8" }, "downloads": -1, "filename": "django-charitychecker-1.1.zip", "has_sig": false, "md5_digest": "9345e207215e39042159d92a335a1cfa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19620, "upload_time": "2014-10-29T00:47:52", "url": "https://files.pythonhosted.org/packages/42/7e/51415ed5fa84797b7e21f5281a8f48bd34aabf6f6f63dd9d09c986992aeb/django-charitychecker-1.1.zip" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "4bf044441ede69e1a9147868426daa45", "sha256": "4398d461d088153d10bd8260fdce5cea21a8e4470b97a8c292d8171872bbd3f8" }, "downloads": -1, "filename": "django-charitychecker-1.2.zip", "has_sig": false, "md5_digest": "4bf044441ede69e1a9147868426daa45", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36233649, "upload_time": "2014-10-30T22:30:35", "url": "https://files.pythonhosted.org/packages/1c/c3/b44c409121420257eac20e7b288927602e99de154fe51e94142e6141827b/django-charitychecker-1.2.zip" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "fe3d84538b9f7872ffb6ebfb2f158e6d", "sha256": "207ade09ce1bb9a465ce463a30902754fa9f639df67e0b976c921463bfc448bb" }, "downloads": -1, "filename": "django-charitychecker-1.3.zip", "has_sig": false, "md5_digest": "fe3d84538b9f7872ffb6ebfb2f158e6d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36233846, "upload_time": "2014-11-03T03:10:38", "url": "https://files.pythonhosted.org/packages/0e/31/02ac2a631f9f134e78467eb9a465a029b7e981d788fc9507f953c5806edd/django-charitychecker-1.3.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fe3d84538b9f7872ffb6ebfb2f158e6d", "sha256": "207ade09ce1bb9a465ce463a30902754fa9f639df67e0b976c921463bfc448bb" }, "downloads": -1, "filename": "django-charitychecker-1.3.zip", "has_sig": false, "md5_digest": "fe3d84538b9f7872ffb6ebfb2f158e6d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36233846, "upload_time": "2014-11-03T03:10:38", "url": "https://files.pythonhosted.org/packages/0e/31/02ac2a631f9f134e78467eb9a465a029b7e981d788fc9507f953c5806edd/django-charitychecker-1.3.zip" } ] }