

import urllib3
import BaseCore
from elasticsearch import Elasticsearch

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

es = Elasticsearch([{'host': '114.115.215.250', 'port': '9700'}], http_auth=('elastic', 'zzsn9988'), timeout=600)

baseCore = BaseCore.BaseCore()
log = baseCore.getLogger()
r = baseCore.r
cnx = baseCore.cnx
cursor = baseCore.cursor
cnx_11 = baseCore.cnx_
cursor_11 = baseCore.cursor_

def getList():
    sql = 'Select id,item_id,year from clb_sys_attachment where type_id = 1'
    cursor_11.execute(sql)
    datas = cursor_11.fetchall()

    gg_social_list = [str(item[1]) + "|" + str(item[0]) + "|" + str(item[2]) for item in datas]
    print('=======')
    for item in gg_social_list:
        r.rpush("NianBao:info", item)

if __name__ == "__main__":
    getList()
