Skip to content

Commit

Permalink
fix:修复登录460问题 (#805)
Browse files Browse the repository at this point in the history
  • Loading branch information
lozzo authored and kigawas committed Apr 14, 2019
1 parent 1234e66 commit 8a7c1cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion NEMbox/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def make_cookie(self, name, value):
rest=None,
)

def request(self, method, path, params={}, default={"code": -1}, custom_cookies={}):
def request(self, method, path, params={}, default={"code": -1}, custom_cookies={'os':'pc'}):
endpoint = "{}{}".format(BASE_URL, path)
csrf_token = ""
for cookie in self.session.cookies:
Expand Down

1 comment on commit 8a7c1cf

@oldoldstone
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改了这个,我反而登录不上了,我是手机号登录,错误代码如下,貌似无法取得cookie
改成原来的代码的可以正常登陆,系统archlinux + Python 3.7.4

File "/usr/lib/python3.7/site-packages/NEMbox/main.py", line 34, in start
nembox_menu.start_fork(version)
File "/usr/lib/python3.7/site-packages/NEMbox/menu.py", line 231, in start_fork
Menu().start()
File "/usr/lib/python3.7/site-packages/NEMbox/menu.py", line 369, in start
self.dispatch_enter(idx)
File "/usr/lib/python3.7/site-packages/NEMbox/menu.py", line 670, in dispatch_enter
self.choice_channel(idx)
File "/usr/lib/python3.7/site-packages/NEMbox/menu.py", line 880, in choice_channel
myplaylist = self.request_api(self.api.user_playlist, self.userid)
File "/usr/lib/python3.7/site-packages/NEMbox/menu.py", line 835, in request_api
if not self.login():
File "/usr/lib/python3.7/site-packages/NEMbox/menu.py", line 151, in login
resp = self.api.login(account, md5pass)
File "/usr/lib/python3.7/site-packages/NEMbox/api.py", line 394, in login
self.session.cookies.save()
File "/usr/lib/python3.7/http/cookiejar.py", line 1890, in save
f.write(self.as_lwp_str(ignore_discard, ignore_expires))
File "/usr/lib/python3.7/http/cookiejar.py", line 1877, in as_lwp_str
r.append("Set-Cookie3: %s" % lwp_cookie_str(cookie))
File "/usr/lib/python3.7/http/cookiejar.py", line 1843, in lwp_cookie_str
keys = sorted(cookie._rest.keys())
AttributeError: 'NoneType' object has no attribute 'keys'

Please sign in to comment.