1 Star 0 Fork 141

forkzj/ECommerceCrawlers

forked from DTC2/ECommerceCrawlers 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
dbproduct.py 557 Bytes
一键复制 编辑 原始数据 按行查看 历史
python 提交于 2019-05-18 17:53 . init commit
from pymongo import MongoClient, ASCENDING
from settings import MONGO_PORT, MONGO_IP
class Mongo():
def __init__(self, ip=MONGO_IP, port=MONGO_PORT):
conn = MongoClient(ip, port)
self.db = conn.taobao
self.collection = self.db.product
self.collection.create_index([('nid', ASCENDING)])
def insert(self, item_dict):
self.collection.insert_one(item_dict)
def delete_all(self, query_dict):
self.collection.delete_many(query_dict)
def count(self):
self.collection.count_documents({})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/forkzj/ECommerceCrawlers.git
git@gitee.com:forkzj/ECommerceCrawlers.git
forkzj
ECommerceCrawlers
ECommerceCrawlers
master

搜索帮助