<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: 400 Error from Get Recommendations in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/400-Error-from-Get-Recommendations/m-p/5642009#M10869</link>
    <description>&lt;P&gt;Thanks Josh. I updated to plural and still not having success.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Somewhat different error message:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;spotipy.exceptions.SpotifyException: http status: 400, code:-1 - https://api.spotify.com/v1/recommendations?limit=20&amp;amp;target_valence=0.3:
 invalid request, reason: None&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 26 Sep 2023 19:57:05 GMT</pubDate>
    <dc:creator>mashmia</dc:creator>
    <dc:date>2023-09-26T19:57:05Z</dc:date>
    <item>
      <title>400 Error from Get Recommendations</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/400-Error-from-Get-Recommendations/m-p/5632567#M10648</link>
      <description>&lt;P class=""&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;Context&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;I use the recommendations api all the time. In a new code base, it fails and I can't figure out why. The code is the same.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;Error message&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;spotipy.exceptions.SpotifyException: http status: 400, code:-1 - &lt;A href="https://api.spotify.com/v1/recommendations?limit=20&amp;amp;target_valence=0.3:" target="_blank" rel="noopener"&gt;https://api.spotify.com/v1/recommendations?limit=20&amp;amp;target_valence=0.3:&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Code snippets&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;recommendations&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;self&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;current_user&lt;/SPAN&gt;&lt;SPAN&gt;.recommendations(&lt;/SPAN&gt;&lt;SPAN&gt;limit&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;20&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;market&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;'US'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;seed_artist&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;'4NHQUGzhtTLFvgF5SZesLK'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;target_valence&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;.3&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Auth function&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;@&lt;/SPAN&gt;&lt;SPAN&gt;app&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN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;.current_user()[&lt;/SPAN&gt;&lt;SPAN&gt;"display_name"&lt;/SPAN&gt;&lt;SPAN&gt;] &lt;/SPAN&gt;&lt;SPAN&gt;not&lt;/SPAN&gt; &lt;SPAN&gt;in&lt;/SPAN&gt;&lt;SPAN&gt; [&lt;/SPAN&gt;&lt;SPAN&gt;'kornacle'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'Mashmia'&lt;/SPAN&gt;&lt;SPAN&gt;]:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;mp&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;track&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;current_user&lt;/SPAN&gt;&lt;SPAN&gt;.current_user()[&lt;/SPAN&gt;&lt;SPAN&gt;'display_name'&lt;/SPAN&gt;&lt;SPAN&gt;], &lt;/SPAN&gt;&lt;SPAN&gt;'Login Successful'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;except&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;pass&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;login_user&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;current_user&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;redirect&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;url_for&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'login'&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 06 Sep 2023 17:56:47 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/400-Error-from-Get-Recommendations/m-p/5632567#M10648</guid>
      <dc:creator>mashmia</dc:creator>
      <dc:date>2023-09-06T17:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Error from Get Recommendations</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/400-Error-from-Get-Recommendations/m-p/5636179#M10728</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.spotify.com/t5/user/viewprofilepage/user-id/25725806"&gt;@mashmia&lt;/a&gt;&amp;nbsp;- thanks for posting that code sample!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I noticed that you have spelt the &lt;SPAN&gt;seed_artists parameter in the singular. Does it help if you change that to seed_artists, and pass it an array rather than a single string? Here is an example using the client credentials OAuth flow:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import spotipy
from spotipy.oauth2 import SpotifyClientCredentials

sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials(client_id="client_id",
                                                           client_secret="client_secret"))

reccos = sp.recommendations(limit=20, market='US', seed_artists=['4NHQUGzhtTLFvgF5SZesLK'],target_valence=.3)&lt;/LI-CODE&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 10:59:12 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/400-Error-from-Get-Recommendations/m-p/5636179#M10728</guid>
      <dc:creator>spotifyjosh</dc:creator>
      <dc:date>2023-09-14T10:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Error from Get Recommendations</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/400-Error-from-Get-Recommendations/m-p/5642009#M10869</link>
      <description>&lt;P&gt;Thanks Josh. I updated to plural and still not having success.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Somewhat different error message:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;spotipy.exceptions.SpotifyException: http status: 400, code:-1 - https://api.spotify.com/v1/recommendations?limit=20&amp;amp;target_valence=0.3:
 invalid request, reason: None&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 26 Sep 2023 19:57:05 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/400-Error-from-Get-Recommendations/m-p/5642009#M10869</guid>
      <dc:creator>mashmia</dc:creator>
      <dc:date>2023-09-26T19:57:05Z</dc:date>
    </item>
  </channel>
</rss>

