{"id":20130389,"url":"https://github.com/aschleg/petpy","last_synced_at":"2025-04-09T10:06:39.817Z","repository":{"id":51992798,"uuid":"110353196","full_name":"aschleg/petpy","owner":"aschleg","description":"Petpy is an easy-to-use and convenient Python wrapper for the Petfinder API. Includes methods for parsing output JSON into pandas DataFrames for easier data analysis","archived":false,"fork":false,"pushed_at":"2024-11-25T01:00:01.000Z","size":11388,"stargazers_count":27,"open_issues_count":1,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T09:06:58.154Z","etag":null,"topics":["api-wrapper","petfinder-api","petfinder-database","pets","python","python-wrapper"],"latest_commit_sha":null,"homepage":"http://petpy.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aschleg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-11T14:46:07.000Z","updated_at":"2025-01-18T08:24:34.000Z","dependencies_parsed_at":"2024-12-17T05:12:07.364Z","dependency_job_id":"a5dd5a22-81b7-488e-a010-606a7d35bebf","html_url":"https://github.com/aschleg/petpy","commit_stats":{"total_commits":210,"total_committers":5,"mean_commits":42.0,"dds":0.5476190476190477,"last_synced_commit":"56e6ff24d058d4b441264924857012325e310fb3"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aschleg%2Fpetpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aschleg%2Fpetpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aschleg%2Fpetpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aschleg%2Fpetpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aschleg","download_url":"https://codeload.github.com/aschleg/petpy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248018060,"owners_count":21034048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-wrapper","petfinder-api","petfinder-database","pets","python","python-wrapper"],"created_at":"2024-11-13T20:38:22.995Z","updated_at":"2025-04-09T10:06:39.790Z","avatar_url":"https://github.com/aschleg.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Petpy - Python Wrapper for the Petfinder API\r\n\r\n[![Documentation Status](https://readthedocs.org/projects/petpy/badge/?version=latest)](http://petpy.readthedocs.io/en/latest/?badge=latest)\r\n[![Coverage Status](https://coveralls.io/repos/github/aschleg/petpy/badge.svg?branch=master)](https://coveralls.io/github/aschleg/petpy?branch=master)\r\n[![codecov](https://codecov.io/gh/aschleg/petpy/branch/master/graph/badge.svg)](https://codecov.io/gh/aschleg/petpy)\r\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/ac2a4c228a9e425ba11af69f7a5c9e51)](https://www.codacy.com/app/aschleg/petpy?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=aschleg/petpy\u0026amp;utm_campaign=Badge_Grade)\r\n[![Dependencies](https://img.shields.io/librariesio/github/aschleg/petpy.svg?label=dependencies)](https://libraries.io/github/aschleg/petpy)\r\n[![https://pypi.org/project/petpy/](https://img.shields.io/badge/pypi%20version-2.4.2-blue.svg)](https://pypi.org/project/petpy/)\r\n[![https://pypi.org/project/petpy/](https://img.shields.io/badge/python-3.6%2C%203.7%2C%203.8%2C%203.9%2C%203.10%2C%203.11%2C%203.12-blue.svg)](https://pypi.org/project/petpy/)\r\n\r\n:cat2: :dog2: :rooster: :rabbit2: :racehorse:\r\n\r\n## Installation\r\n\r\n`petpy` is easily installed through `pip`.\r\n\r\n~~~ python\r\npip install petpy\r\n~~~\r\n\r\nThe library can also be cloned or downloaded into a location of your choosing and then installed using the `setup.py` \r\nfile per the following:\r\n\r\n~~~ python\r\ngit clone git@github.com:aschleg/petpy.git\r\ncd petpy\r\npython setup.py install\r\n~~~\r\n\r\n## Examples and usage\r\n\r\nAn account must first be created with [Petfinder](https://www.petfinder.com/developers/) to receive an API and secret \r\nkey. The API and secret key will be used to grant access to the Petfinder API, which lasts for 3600 seconds, or one \r\nhour. After the authentication period ends, you must re-authenticate with the Petfinder API. The following are some \r\nquick examples for using `petpy` to get started. More in-depth tutorials for `petpy` and some examples of what \r\ncan be done with the library, please see the More Examples and Tutorials section below.\r\n\r\n### Authenticating with the Petfinder API\r\n\r\nAuthenticating the connection with the Petfinder API is done at the same time the `Petfinder` class is initialized.\r\n\r\n~~~ python\r\npf = Petfinder(key=key, secret=secret)\r\n~~~\r\n\r\nThe following are some quick examples for getting started with `petpy` and the Petfinder API.\r\n### Finding animal types\r\n\r\n~~~ python\r\n# All animal types and their relevant data.\r\nall_types = pf.animal_types()\r\n\r\n# Returning data for a single animal type\r\ndogs = pf.animal_types('dog')\r\n\r\n# Getting multiple animal types at once\r\ncat_dog_rabbit_types = pf.animal_types(['cat', 'dog', 'rabbit'])\r\n~~~\r\n\r\n### Getting animal breeds for available animal types\r\n\r\n~~~ python\r\ncat_breeds = pf.breeds('cat')\r\ndog_breeds = pf.breeds('dog')\r\n\r\n# All available breeds or multiple breeds can also be returned.\r\n\r\nall_breeds = pf.breeds()\r\ncat_dog_rabbit = pf.breeds(types=['cat', 'dog', 'rabbit'])\r\n~~~ \r\n\r\nThe `breeds` method can also be set to coerce the returned JSON results into a pandas DataFrame by setting \r\nthe parameter `return_df = True`.\r\n\r\n~~~ python\r\ncat_breeds_df = pf.breeds('cat', return_df = True)\r\nall_breeds_df = pf.breeds(return_df = True)\r\n~~~\r\n\r\n### Finding available animals on Petfinder\r\n\r\nThe `animals()` method returns animals based on specified criteria that are listed in the Petfinder database. Specific \r\nanimals can be searched using the `animal_id` parameter, or a search of the database can be performed by entering \r\nthe desired search criteria.\r\n\r\n~~~ python\r\n# Getting first 20 results without any search criteria\r\nanimals = pf.animals()\r\n\r\n# Extracting data on specific animals with animal_ids\r\n\r\nanimal_ids = []\r\nfor i in animals['animals'][0:3]:\r\n    animal_ids.append(i['id'])\r\n    \r\nanimal_data = pf.animals(animal_id=animal_ids)\r\n\r\n# Returning a pandas DataFrame of the first 150 animal results\r\nanimals = pf.animals(results_per_page=50, pages=3, return_df=True)\r\n~~~\r\n\r\n### Getting animal welfare organizations in the Petfinder database \r\n\r\nSimilar to the `animals()` method described above, the `organizations()` method returns data on animal welfare \r\norganizations listed in the Petfinder database based on specific criteria, if any. In addition to a general search \r\nof animal welfare organizations, specific organizational data can be extracted by supplying the `organizations()` \r\nmethod with organization IDs.\r\n\r\n~~~ python\r\n# Return the first 1,000 animal welfare organizations as a pandas DataFrame\r\n\r\norganizations = pf.organizations(results_per_page=100, pages=10, return_df=True)\r\n\r\n# Get organizations in the state of Washington\r\n\r\nwa_organizations = pf.organizations(state='WA')\r\n~~~\r\n\r\n## More Examples and Tutorials\r\n\r\n[![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/aschleg/petpy/master?filepath=notebooks)\r\n\r\nA series of IPython notebooks that introduce and explore some of the functionality and possible uses of the \r\n`petpy` library. The notebooks can also be launched interactively with [binder](https://mybinder.org/) by clicking the \r\n\"launch binder\" badge.\r\n\r\n* [01 -Introduction to petpy](https://github.com/aschleg/petpy/blob/master/notebooks/01-Introduction%20to%20petpy.ipynb)\r\n* [02 - Download 45,000 Adoptable Cat Images using petpy and multiprocessing](https://github.com/aschleg/petpy/blob/master/notebooks/02-Download%2045%2C000%20Adoptable%20Cat%20Images%20with%20petpy%20and%20multiprocessing.ipynb)\r\n  - Please note the following notebook is still based on the legacy version of Petfinder and thus are not fully \r\n    representative of the functionality and methods of the most recent version of `petpy` and the Petfinder API. These \r\n    are currently being updated to reflect the new version of `petpy`.\r\n* [03 - Download Pure Breeds Cat Images with petpy for Deep Neural Network training](https://github.com/aschleg/petpy/blob/master/notebooks/03-Download%20Pure%20Breeds%20Cat%20Images%20with%20petpy%20for%20Deep%20Neural%20Network%20training%20-%20multiprocessing.ipynb)\r\n  - Provided by contributor [ma755](https://github.com/ma7555)\r\n\r\n### Other\r\n\r\nThe following are longer usage examples and tutorials that have been posted to external media websites such as \r\n[Medium.com](medium.com):\r\n\r\n* [Analyze Petfinder Adoptable Pet Descriptions with the IBM Watson Tone Analyzer — Part One](https://medium.com/@AaronSchlegel/analyze-petfinder-adoptable-pet-descriptions-with-the-ibm-watson-tone-analyzer-part-one-4efabaa1164b)\r\n\r\n## Documentation\r\n\r\n* [Petpy documentation](http://petpy.readthedocs.io/en/latest/)\r\n* [Petpy changelog](https://github.com/aschleg/petpy/blob/master/CHANGELOG.md)\r\n* [Petfinder API v2.0 documentation](https://www.petfinder.com/developers/v2/docs/)\r\n\r\n## Requirements\r\n\r\n* Python \u003e= 3.6\r\n* [requests](http://docs.python-requests.org/en/master/) \u003e= 2.18.4\r\n* Although not strictly required to use `petpy`, the [pandas](https://pandas.pydata.org/) library is needed \r\n  for returning the results as a DataFrame.\r\n\r\n## About [Petfinder.com](https://www.petfinder.com)\r\n\r\nPetfinder.com is one of the largest online, searchable databases for finding a new pet online. The database contains \r\ninformation on over 14,000 animal shelters and adoption organizations across North America with nearly 300,000 animals \r\navailable for adoption. Not only does this make it a great resource for those looking to adopt their new best friend, \r\nbut the data and information provided in Petfinder's database makes it ideal for analysis. \r\n\r\n## Contributors\r\n\r\n* [ma755](https://github.com/ma7555) - Fixed several functions that use an `animal` parameter and \r\n  implementing checks for exceeding the Petfinder API limit.\r\n* [ljlevins](https://github.com/ljlevins) - Found and fixed an error with the `distance` parameter used in the \r\n  `organizations` API endpoint.  \r\n\r\n## License\r\n\r\nMIT\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faschleg%2Fpetpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faschleg%2Fpetpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faschleg%2Fpetpy/lists"}