abhichaudharii / abhichaudharii/jiosaavn-python

Non async function

Đang mở
#3 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug enhancement good first issue
Ngôn ngữ chính
Python
Star
2
Fork
1
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I am trying to retrieve songs from a playlist and here's the function that I have right now (running it in Jupyter notebook):

```python
import json
import asyncio
from jiosaavn import JioSaavn
import nest_asyncio

saavn = JioSaavn()
nest_asyncio.apply()

# Define a function to get playlist songs by id
async def get_playlist_songs(playlist_url):
# Use the async method from saavn
songs = await saavn.get_playlist_songs(playlist_url)
# Return a list of songs with details
return songs

playlist_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 . See https://www.python-httpx.org/async/#opening-and-closing-clients for details.`

A couple of questions for you:
1. How would you modify the code to run without using `asyncio`? I tried a few combinations but I kept getting errors. Appreciate your input.
2. Can we remove `page=1, limit=100` from the `get_playlist_songs` function call?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.