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

sina_spider1项目里面有个bug: #67

Open
ITzhicheng opened this issue Nov 22, 2017 · 1 comment
Open

sina_spider1项目里面有个bug: #67

ITzhicheng opened this issue Nov 22, 2017 · 1 comment

Comments

@ITzhicheng
Copy link

cookies.py中的cookies数组里面放的是string数据类型,在debug的时候发现下载器中间件调用了一个这个方法:
def _format_cookie(self, cookie):
cookie_str = '%s=%s' % (cookie['name'], cookie['value'])
因为我们传的cookie是string类型,所以我这里debug的时候报了一个这样的错误:TypeError: string indices must be integers, not str。(String类型的索引必须是整数)
最后自己改了一下spider1源码:将原来登录成功后的cookie以dict类型放入cookies数组里就没问题了。

@zhanghanbin3159
Copy link

cookies.py代码修改如下:
# return json.dumps(cookie)
return cookie # 返回类型设置成dick

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

No branches or pull requests

2 participants