Skip to main content

A XenoCanto API wrapper for Python

Project description

CantoPy

CantoPy is an API wrapper and download utility designed for easy scraping of animal sound recordings from the Xeno-Canto database.

Installation

Download the latest published version of this package from PyPI by running the following command:

pip install cantopy

Usage

The CantoPy package contains three main components to look up and download recordings from the Xeno-Canto API: the Query class, FetchManager, and DownloadManager.

The following example demonstrates how to use these components to retrieve high-quality recordings of a common blackbird (Turdus merula):

from cantopy import Query, FetchManager, DownloadManager

# Initialize the search query
query = Query(species_name="common blackbird", quality="A")

# Find matching query results on the Xeno-Canto database
query_result = FetchManager.send_query(query, max_pages=3)

# Initialize a DownloadManager
download_manager = DownloadManager("<download_base_folder>", max_workers=2)

# Download the corresponding recordings of the retrieved results
download_manager.download_all_recordings_in_queryresult(query_result)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cantopy-0.2.0.tar.gz (10.2 kB view hashes)

Uploaded Source

Built Distribution

cantopy-0.2.0-py3-none-any.whl (13.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page