Skip to content

Commit

Permalink
updata README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura committed Aug 25, 2022
1 parent 07373ad commit d7285d3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,27 @@ async def main():
for comment in comments:
print(f"{comment.user_str}: {comment.content}")

asyncio.run(main())
```

## 错误处理

API 返回 200 以外状态码触发 Music163BadCode 错误

错误对象.code 获取 API 状态码,错误对象.data 获取 API 数据

```python
from pycloudmusic import Music163Api, Music163BadCode
import asyncio


async def main():
musicapi = Music163Api()

try:
playlist = await musicapi.playlist(7487291782)
except Music163BadCode as err:
print(err, err.code, err.data)

asyncio.run(main())
```

0 comments on commit d7285d3

Please sign in to comment.