[英]Not able to store tweets in CouchDB
I retrieved user information using api.followers in tweepy and am trying to store them in couchDB, but I keep getting this error message "u'doc validation, u'Bad Special document member" _json". 我在tweepy中使用api.followers检索了用户信息,并试图将它们存储在bedDB中,但我不断收到此错误消息“ u'doc验证,u'Bad特殊文档成员” _json”。
def save_user(self, u):
temp = jsonpickle.encode(u)
temp_obj = json.loads(temp)
user_obj = temp_obj['py/state']
self.db.save(user_obj)
u is the user profile returned by the command u是命令返回的用户配置文件
for user in api.followers(screen_name="sharonsanderso6"): storage.save_user(user) 对于api.followers(screen_name =“ sharonsanderso6”)中的用户:storage.save_user(user)
directly storing user to couchDB gives an error "string indices must be integers,not str". 将用户直接存储到bedDB会产生错误“字符串索引必须是整数,而不是str”。 So tried decoding it using jsonpickle and json.loads.
因此,尝试使用jsonpickle和json.loads对其进行解码。 after doing this I get u'Bad character error.
完成此操作后,我得到u'Bad字符错误。 How else can I store it couchDB?
我还可以将其存储在bedDB中吗?
Bad Special document member _json
错误的特殊文档成员_json
CouchDB reserves JSON properties beginning with an underscore for itself. CouchDB保留以下划线开头的JSON属性。 Change the key of the property to something that doesn't starts with underscore.
将属性的键更改为不以下划线开头的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.