介绍:EChelper是一个基于Python的ECShop商品管理接口。本接口由鲲鹏数据(https://www.site-digger.com)技术人员开发。目的是利用已采集商品数据,快速建立和维护ECShop站点。功能特性:1)添加品牌、根据名称获取品牌ID。2)上传新商品。3)更新已存在商品。4)本地图片上传5)设置商品主图。6)添加商品相册。7)兼容ECShopUTF8和GBK版本(测试版本:v2.7.3)。7)独立工作,不需要增加或修改ECShop源代码(只需要MySQL和FTP参数)。依赖库:MySQLdb-https://mysql-python.sourceforge.net/PIL-https://www.pythonware.com/products/pil/示例:ecshop=echelper.ECHelper()#根据分类名称获取分类IDcat_id=ecshop.get_catid(cat_name='3G手机')#支持模糊查找printecshop.get_catid(cat_name='3G',fuzzy=True)#添加品牌brand_id=ecshop.add_brand(brand_name='鲲鹏数据')#上传商品goods={}goods['cat_id']=cat_idgoods['goods_name']='鲲鹏WEB数据采集-测试商品'goods['market_price']=888goods['shop_price']=88goods['goods_number']=1000goods['goods_desc']='没错,原价888元的手机,本店只卖88元!It\'sjustajoke!'goods['brand_id']=brand_idgoods_id=ecshop.upload_goods(goods)#设置商品上线,也可以在上传的时候直接设置ecshop.set_onsale(goods_id=goods_id,is_on_sale=1)#上传图片upload_status,img_url,thumb_url,img_original=ecshop.upload_photo(image_src='pic1.jpg')#设置商品主图ifupload_status: ecshop.set_goods_photo(goods_id=goods_id,img_url=img_url,thumb_url=thumb_url,img_original=img_original) #为商品添加相册图ifupload_status: ecshop.add_goods_gallery(goods_id=goods_id,img_url=img_original,thumb_url=thumb_url,img_original=img_original,img_desc='pic1')#上传、添加另一张相册图upload_status,img_url,thumb_url,img_original=ecshop.upload_photo(image_src='pic2.jpg')ifupload_status: ecshop.add_goods_gallery(goods_id=goods_id,img_url=img_original,thumb_url=thumb_url,img_original=img_original,img_desc='pic2')详情见test.py文件。
点击空白处退出提示
评论