Beispiel #1
0
def department():
    api_method = 'organization/v1/queryOrganization'
    # api_bodyValue= ''
    km = KangMian(api_method, '{}')
    responseData = km.callAPI()
    # print(type(responseData))
    print(responseData)
Beispiel #2
0
def employee():
    api_method = 'employee/v2/queryEmployee'
    # api_bodyValue= ''
    km = KangMian(api_method, '{}')
    responseData = km.callAPI()
    emp = ParseEmployee()
    sqlDict, colDict = emp.getTabAndSql_Dict()

    list_sql = Util.dealResponseData(responseData, sqlDict, colDict)
    print(len(list_sql))
    pg = pypgsql.dba()
    pg.execListSql(list_sql)
Beispiel #3
0
    'store_v1_querystore_linkmans'
]

pg = pypgsql.dba()
sql_truncate = 'truncate table '
for _ in tableName:
    _sql = sql_truncate + schemaName + '.' + _ + ';'
    print(_sql)
    pg.execsql(_sql)

i = 0
while True:
    i += 1
    api_bodyValue = '{"page_number":"' + str(i) + '"}'
    print(api_bodyValue)
    # exit(0)
    km = KangMian(api_method, api_bodyValue)
    # 拿到ResponData
    responseData = km.callAPI()
    if len(responseData) == 0:
        break
    # 拿到对应的数据库结构
    sqlDict, colDict = common.getDict(schemaName, tableName)

    list_sql = Util.dealResponseData(responseData, sqlDict, colDict)
    print(len(list_sql))
    t1 = time.time()

    pg.execListSql(list_sql)
    print(time.time() - t1)