shazamio / ShazamIO

🎵 Is a free asynchronous library from reverse engineered Shazam API written in Python 3.8+ with asyncio and aiohttp.
MIT License
490 stars 69 forks source link

First try at configurable country for the endpoints #51

Closed rajb245 closed 1 year ago

rajb245 commented 1 year ago

As we've been discussing in #50, it could be useful to not always hit the shazam "GB" endpoint, but use another country. That discussion shows that the data returned is different depending on which one you use. This patch makes that configurable when you create a shazam instance. Like this:

shazam = Shazam(endpoint_country="US")

And then you use it like normal. The default for the new parameter is "GB", leaving the old behavior intact.

rajb245 commented 1 year ago

Also worth saying I haven't extensively tested this, just enough to make sure it works for my case of calling shazam.track_about and getting back ID numbers that I can lookup in the iTunes store API.