Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

最新版本(0.2.3.8)仍然无法使用邮箱登录 #500

Closed
dumplingsMing opened this issue Mar 2, 2017 · 2 comments · Fixed by #502
Closed

最新版本(0.2.3.8)仍然无法使用邮箱登录 #500

dumplingsMing opened this issue Mar 2, 2017 · 2 comments · Fixed by #502

Comments

@dumplingsMing
Copy link

在使用0.2.3.8版本时,发现邮箱登录问题仍然尚未解决

在代码中添加如下输出,查看log可发现并没有输出'action: blabla',程序内部提示登录失败

    def login(self, username, password):
        log.debug('login: %s, %s' %(username, password))
        pattern = re.compile(r'^0\d{2,3}\d{7,8}$|^1[34578]\d{9}$')
        if pattern.match(username):
            return self.phone_login(username, password)
        action = 'https://music.163.com/weapi/login?csrf_token='
        self.session.cookies.load()
        csrf = ''
        for cookie in self.session.cookies:
            if cookie.name == '__csrf':
                csrf = cookie.value
        if csrf == '':
            return {'code': 501}
        action += csrf
        log.debug("action: " + action)
        text = {
            'username': username,
            'password': password,
            'rememberLogin': 'true'
        }
        data = encrypted_request(text)
        try:
            ret = self.httpRequest('Login_POST', action, data)
            log.debug(ret)
            return ret
        except requests.exceptions.RequestException as e:
            log.error(e)
            return {'code': 501}
@yaphone
Copy link
Contributor

yaphone commented Mar 2, 2017

已修正,待merge

@yaphone
Copy link
Contributor

yaphone commented Mar 2, 2017

此现象出现在取不到session的情况(如新用户第一次登陆),经测试,csrf_token为空时也可以正常登陆,已修正,待merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants