You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to retrieve songs from a playlist and here's the function that I have right now (running it in Jupyter notebook):
importjsonimportasynciofromjiosaavnimportJioSaavnimportnest_asynciosaavn=JioSaavn()
nest_asyncio.apply()
# Define a function to get playlist songs by idasyncdefget_playlist_songs(playlist_url):
# Use the async method from saavnsongs=awaitsaavn.get_playlist_songs(playlist_url)
# Return a list of songs with detailsreturnsongsplaylist_url="https://www.jiosaavn.com/featured/weekly-top-songs/8MT-LQlP35c_"data=asyncio.run(saavn.get_playlist_songs(playlist_url, page=1, limit=100))
It works but gives me a warning UserWarning: Unclosed <httpx.AsyncClient object at 0x000001DDD757F850>. See https://www.python-httpx.org/async/#opening-and-closing-clients for details.
A couple of questions for you:
How would you modify the code to run without using asyncio? I tried a few combinations but I kept getting errors. Appreciate your input.
Can we remove page=1, limit=100 from the get_playlist_songs function call?
The text was updated successfully, but these errors were encountered:
Thanks for asking and reporting the issue. You are getting that warning because I made a mistake while writing the wrapper. I will push a fix for that soon.
You cant call async functions without using asyncio. I'm planning to release synchronous and asynchronous functions. Then you won't need asyncio.
Yes, you can remove page=1, limit=100 those are optional arguments. My example shows the use of those keyword arguments because I wanted to show that you can limit the results. But you don't need to pass them always
I am trying to retrieve songs from a playlist and here's the function that I have right now (running it in Jupyter notebook):
It works but gives me a warning
UserWarning: Unclosed <httpx.AsyncClient object at 0x000001DDD757F850>. See https://www.python-httpx.org/async/#opening-and-closing-clients for details.
A couple of questions for you:
asyncio
? I tried a few combinations but I kept getting errors. Appreciate your input.page=1, limit=100
from theget_playlist_songs
function call?The text was updated successfully, but these errors were encountered: