sleepyfran / itunespy

:snake: A simple library to fetch data from the iTunes Store API made for Python >= 3.5
MIT License
64 stars 6 forks source link

Add country support for sub-queries #9

Closed codello closed 4 years ago

codello commented 4 years ago

When searching the iTunes API it is possible to specify a country. This way one might get a MusicAlgum from the _get_result_list method. Using the get_tracks method on such an album will lookup the album. This however does not retain the country that was initially specified. For albums that are not available on the default (US) iTunes Store this causes get_tracks to effectively fail (no results are returned).

This pull request adds the country field to ResultItem and retains the country from a search or lookup operation in the respective results. It also modifies the get_tracks method to lookup tracks in the same country that the MusicAlbum belongs to.

codello commented 4 years ago

Hey, Thanks for the review. I replied to your comment but I noticed some other issues with the PR, so here's an update:

While working on this I noticed that itunespy currently does not include type annotations. I could create another pull request adding type hints. This would however break compatibility with Python 3.4 (which has reached its EOL anyway). What do you think?

sleepyfran commented 4 years ago

Okay, this looks perfect! Also love the idea of adding type annotations, so feel free to create another PR with that. I'll merge this and once the PR with the type annotations is ready I'll create another version of the library and publish it. Thank you so much for the contribution! 😃