Python API wrapper for encore.us
Project description
encore-python
Python API wrapper for encore.us
Features
- Music Search: Perform searches by track name, album, artist, genre, and year with both basic and advanced filtering options.
- Download Tracks: Download music tracks directly using the song identifier or a
Song
object. - Rate Limit Handling: Automatically handles API rate limits, providing feedback on the remaining number of queries and reset times.
- Flexible Search Queries: Supports both simple string queries and structured search objects (
BasicSearch
andAdvancedSearch
).
Instalation
From pip
pip install encore-python
From repository
git clone https://github.com/joshrmcdaniel/encore-python.git
cd encore-python
pip install -e .
Usage
Basic Search
To perform a basic search by track name, album, artist, genre, or year:
from encore_python import EncoreAPI
api = EncoreAPI()
# Basic search by track name
response = api.search("Track Name")
Advanced Search
For more complex queries involving multiple criteria:
# Advanced search by artist with additional filters
response = api.search_by_artist("Artist Name", exact=True)
Iterating search results
The ability to iterate through all results is avaiable with the iter_results
arg
Downloading Tracks
Downloading tracks is available. Available options include: sng file, convert from the sng format to the directory format, and returning a buffer.
To download a track:
# With the hash as a sng file
api.download("abcedf....")
# With the song json
search_res = api.search("Jeff")
song = search_res.data[0]
api.download(song)
This will download a track into the current working directory with the filename of the download hash, with .sng
Downloading a track and converting it
search_res = api.search("Jeff")
song = search_res.data[0]
api.download(song, as_sng=False)
See sng-format-python docs for other sng conversion args.
Contributing
Contributions to the encore-python are welcome.
License
encore-python is released under the MIT License. See the LICENSE file in the repository for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file encore_python-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: encore_python-1.1.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.6 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.31.0 rfc3986/1.5.0 tqdm/4.64.1 urllib3/1.26.16 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfc48f402e116d16a2da2b26cd3ad8c2d1b6ce390f1a4cc33d195ec192f55ae6 |
|
MD5 | 27be3f05018208e8b9b66ebdeca7260a |
|
BLAKE2b-256 | b122a0486bb28aa846388ee7cd88a871701979c1a1c1c0429d943f7b122f4d10 |