Can’t access spotify genres with Spotipy’s recommendation_genre_seeds() function

I’m currently writing an application that takes in a user prompt and their listening data and creates a playlist for them. I also analyse the prompt with a bart model to identify which genres of music are most suitable.

In trying to get the list of genres that spotify uses with the Spotipy library’s recommendation_genre_seeds() function, I’ve recently (over the past week) run into an exception that I did not previously get. The last time I wrote code for this application was around 3 – 4 weeks ago, when it ran smoothly.

I did some debugging in jupyter notebook. Given that I’ve initialised my spotipy model:

sp = spotipy.Spotify(auth_manager=SpotifyOAuth(client_id=CLIENT_ID, 
                                               client_secret=CLIENT_SECRET, 
                                               redirect_uri=REDIRECT_URI, 
                                               scope="playlist-modify-private playlist-modify-public user-top-read user-read-recently-played user-library-read user-follow-read"))

Here is the snippet of code that throws the exception.

sp.recommendation_genre_seeds()

The exception is as follows.

HTTP Error for GET to https://api.spotify.com/v1/recommendations/available-genre-seeds with Params: {} returned 404 due to None
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
~anaconda3libsite-packagesspotipyclient.py in _internal_call(self, method, url, payload, params)
    274 
--> 275             response.raise_for_status()
    276             results = response.json()

~anaconda3libsite-packagesrequestsmodels.py in raise_for_status(self)
   1020         if http_error_msg:
-> 1021             raise HTTPError(http_error_msg, response=self)
   1022 

HTTPError: 404 Client Error: Not Found for url: https://api.spotify.com/v1/recommendations/available-genre-seeds

During handling of the above exception, another exception occurred:

SpotifyException                          Traceback (most recent call last)
~AppDataLocalTempipykernel_19528936109238.py in <module>
----> 1 sp.recommendation_genre_seeds()

~anaconda3libsite-packagesspotipyclient.py in recommendation_genre_seeds(self)
   1731         """ Get a list of genres available for the recommendations function.
   1732         """
-> 1733         return self._get("recommendations/available-genre-seeds")
   1734 
   1735     def audio_analysis(self, track_id):

~anaconda3libsite-packagesspotipyclient.py in _get(self, url, args, payload, **kwargs)
    325             kwargs.update(args)
    326 
--> 327         return self._internal_call("GET", url, payload, kwargs)
    328 
    329     def _post(self, url, args=None, payload=None, **kwargs):

~anaconda3libsite-packagesspotipyclient.py in _internal_call(self, method, url, payload, params)
    295             )
    296 
--> 297             raise SpotifyException(
    298                 response.status_code,
    299                 -1,

SpotifyException: http status: 404, code:-1 - https://api.spotify.com/v1/recommendations/available-genre-seeds:
 None, reason: None

Is there an issue with the spotify api that has caused Spotipy to crash like this? I’ve tried to look it up, I got some inkling of this issue but I just wanted to confirm that and also see if there’s any workaround for this error.

Please let me know if there is any issue in my question as it is my first time posting on StackOverflow, thank you!

New contributor

spinelessknave8 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật