''' Created on 2018年12月26日 @author: User ''' import sys import os import codecs import re sys.path.append(os.path.abspath("../..")) import requests from BiddingKG.dl.common.Connection import * import time import psycopg2 import glob from BiddingKG.dl.common.Utils import * if __name__=="__main__": #测试接口的代码 #conn = getConnection() conn = psycopg2.connect(dbname="article_label",user="postgres",password="postgres",host="192.168.2.101") cursor = conn.cursor() #validation #sql = " select content,id from articles where id in(select doc_id from articles_validation where exists(select 1 from articles_processed where id=doc_id)) order by id" #training #sql = " select content,id from articles where not exists(select 1 from articles_validation where doc_id=articles.id) order by id limit 5000" sql = " select id from articles_processed " cursor.execute(sql) rows = cursor.fetchall() ids = [] for row in rows: ids.append(row[0]) # 添加对应headers 及 tonken 用于数据传参和登录认证使用 myheaders = {'Content-Type': 'application/json'} # 接口测试数据 #guardian_base = 'http://47.110.128.185:15015' guardian_base1 = 'http://127.0.0.1:15015' guardian_base2 = 'http://192.168.2.101:15015' # 使用requests的post方法进行请求路由 result = [] #content = row[0] #content = "
序号 | \doc_id | \same | \before | \重新训练 | \
"+str(i)+" | "+""+str(item[0])+" | "+""+str(item[1])+" | "+""+str(item[2])+" | "+""+str(item[3])+" | "+"