Skip to content

Commit

Permalink
Version 0.1.1
Browse files Browse the repository at this point in the history
bugfix : Session object not being correctly specified with the following API calls:
`LoginViaCellphone, LoginViaEmail, LoginViaAnonymousAccount,SetUploadObject` (#55)
  • Loading branch information
mos9527 committed Feb 27, 2024
1 parent b5ecef3 commit e3b6170
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyncm_async/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""PyNCM-Async 网易云音乐 Python 异步 API / 下载工具"""
__VERSION_MAJOR__ = 0
__VERSION_MINOR__ = 1
__VERSION_PATCH__ = 0
__VERSION_PATCH__ = 1

__version__ = '%s.%s.%s' % (__VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_PATCH__)

Expand Down
4 changes: 2 additions & 2 deletions pyncm_async/apis/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def GetNosToken(


async def SetUploadObject(
stream, md5, fileSize, objectKey, token, offset=0, compete=True, bucket=BUCKET
stream, md5, fileSize, objectKey, token, offset=0, compete=True, bucket=BUCKET, session=None
):
"""移动端 - 上传内容
Expand All @@ -88,7 +88,7 @@ async def SetUploadObject(
Returns:
dict
"""
r = await GetCurrentSession().post(
r = await (session or GetCurrentSession()).post(
"http://45.127.129.8/%s/" % bucket + objectKey.replace("/", "%2F"),
data=stream,
params={"version": "1.0", "offset": offset, "complete": str(compete).lower()},
Expand Down
6 changes: 3 additions & 3 deletions pyncm_async/apis/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async def LoginViaCellphone(phone="", password="",passwordHash="",captcha="", ct
**auth_token
},
)
)()
)(session=session)

WriteLoginInfo(login_status, session)
return {'code':200,'result':session.login_info}
Expand Down Expand Up @@ -189,7 +189,7 @@ async def LoginViaEmail(email="", password="",passwordHash="", remeberLogin=True
**auth_token
},
)
)()
)(session=session)

WriteLoginInfo(login_status,session)
return {'code':200,'result':session.login_info}
Expand Down Expand Up @@ -218,7 +218,7 @@ async def LoginViaAnonymousAccount(deviceId=None, session=None):
).decode()
}
)
)()
)(session=session)
assert login_status['code'] == 200,"匿名登陆失败"
WriteLoginInfo({
**login_status,
Expand Down

0 comments on commit e3b6170

Please sign in to comment.