Commit 07caf58c by 陈森彬

单独推送品牌到redis中

parent de3ff5d8
Showing with 43 additions and 0 deletions
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
向redis的品牌集合添加品牌
线下在1.235
线上必须在入库服务器
'''
import sys
import redis
ENV = 'test' if sys.platform in ('darwin', 'win32') else 'produce'
def get_redis_conf():
conf = {
'host': '192.168.1.235',
'port': 6379,
'password': "icDb29mLy2s",
'db': 0,
}
if ENV == "produce":
conf['host'] = '127.0.0.1'
return conf
def get_redis_conn():
conf = get_redis_conf()
pool = redis.ConnectionPool(**conf)
task_redis = redis.Redis(connection_pool=pool)
return task_redis
redis_pool = get_redis_conn()
def main():
brand_list = ["英飞凌"]
for brand_name in brand_list:
redis_pool.sadd("brand_set", brand_name)
if __name__ == "__main__":
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment