Package: petpy
Petpy - Python Wrapper for the Petfinder API:cat2: :dog2: :rooster: :rabbit2: :racehorse:Installationpetpyis easily installed throughpip.pipinstallpetpyThe library can also be cloned or downloaded into a location of your choosing and then installed using thesetup.pyfile per the following:gitclonegit@github.com:aschleg/petpy.gitcdpetpypythonsetup.pyinstallExamples and usageAn account must first be created withPetfinderto receive an API and secret
key. The API and secret key will be used to grant access to the Petfinder API, which lasts for 3600 seconds, or one
hour. After the authentication period ends, you must re-authenticate with the Petfinder API. The following are some
quick examples for usingpetpyto get started. More in-depth tutorials forpetpyand some examples of what
can be done with the library, please see the More Examples and Tutorials section below.Authenticating with the Petfinder APIAuthenticating the connection with the Petfinder API is done at the same time thePetfinderclass is initialized.pf=Petfinder(key=key,secret=secret)The following are some quick examples for getting started withpetpyand the Petfinder API.Finding animal types# All animal types and their relevant data.all_types=pf.animal_types()# Returning data for a single animal typedogs=pf.animal_types('dog')# Getting multiple animal types at oncecat_dog_rabbit_types=pf.animal_types(['cat','dog','rabbit'])Getting animal breeds for available animal typescat_breeds=pf.breeds('cat')dog_breeds=pf.breeds('dog')# All available breeds or multiple breeds can also be returned.all_breeds=pf.breeds()cat_dog_rabbit=pf.breeds(types=['cat','dog','rabbit'])Thebreedsmethod can also be set to coerce the returned JSON results into a pandas DataFrame by setting
the parameterreturn_df = True.cat_breeds_df=pf.breeds('cat',return_df=True)all_breeds_df=pf.breeds(return_df=True)Finding available animals on PetfinderTheanimals()method returns animals based on specified criteria that are listed in the Petfinder database. Specific
animals can be searched using theanimal_idparameter, or a search of the database can be performed by entering
the desired search criteria.# Getting first 20 results without any search criteriaanimals=pf.animals()# Extracting data on specific animals with animal_idsanimal_ids=[]foriinanimals['animals'][0:3]:animal_ids.append(i['id'])animal_data=pf.animals(animal_id=animal_ids)# Returning a pandas DataFrame of the first 150 animal resultsanimals=pf.animals(results_per_page=50,pages=3,return_df=True)Getting animal welfare organizations in the Petfinder databaseSimilar to theanimals()method described above, theorganizations()method returns data on animal welfare
organizations listed in the Petfinder database based on specific criteria, if any. In addition to a general search
of animal welfare organizations, specific organizational data can be extracted by supplying theorganizations()method with organization IDs.# Return the first 1,000 animal welfare organizations as a pandas DataFrameorganizations=pf.organizations(results_per_page=100,pages=10,return_df=True)# Get organizations in the state of Washingtonwa_organizations=pf.organizations(state='WA')More Examples and TutorialsA series of IPython notebooks that introduce and explore some of the functionality and possible uses of thepetpylibrary. The notebooks can also be launched interactively withbinderby clicking the
"launch binder" badge.01 -Introduction to petpy02 - Download 45,000 Adoptable Cat Images using petpy and multiprocessingPlease note the following notebook is still based on the legacy version of Petfinder and thus are not fully
representative of the functionality and methods of the most recent version ofpetpyand the Petfinder API. These
are currently being updated to reflect the new version ofpetpy.03 - Download Pure Breeds Cat Images with petpy for Deep Neural Network trainingProvided by contributorma755OtherThe following are longer usage examples and tutorials that have been posted to external media websites such asMedium.com:Analyze Petfinder Adoptable Pet Descriptions with the IBM Watson Tone Analyzer — Part OneDocumentationPetpy documentationPetpy changelogPetfinder API v2.0 documentationRequirementsPython >= 3.6requests>= 2.18.4Although not strictly required to usepetpy, thepandaslibrary is needed
for returning the results as a DataFrame.AboutPetfinder.comPetfinder.com is one of the largest online, searchable databases for finding a new pet online. The database contains
information on over 14,000 animal shelters and adoption organizations across North America with nearly 300,000 animals
available for adoption. Not only does this make it a great resource for those looking to adopt their new best friend,
but the data and information provided in Petfinder's database makes it ideal for analysis.Contributorsma755- Fixed several functions that use ananimalparameter and
implementing checks for exceeding the Petfinder API limit.ljlevins- Found and fixed an error with thedistanceparameter used in theorganizationsAPI endpoint.LicenseMIT