Beispiel #1
0
 def value(sheetname, api_name):
     data = ExcleHelper(r'D:\xingit\wsy\ApiAuto-py3\config\test.xlsx',
                        sheetname)
     url = data.get_value(api_name, 'url')
     path = data.get_value(api_name, 'path')
     headers1 = data.get_value(api_name, 'headers')
     method = data.get_value(api_name, 'method')
     base_params = data.get_value(api_name, 'params')
     cache['url'] = url
     cache['path'] = path
     cache['headers1'] = headers1
     cache['method'] = method
     cache['base-params'] = base_params
     return cache
Beispiel #2
0
     "PG_V1": "237.30",
     "PG_V3": "0.00",
     "PG_V2": "0.00",
     "Et_ge0": "5407",
     "P_INV1": "0.00",
     "a0": "1",
     "V_eme_o1": "236.50",
     "V_Dcp1": "-7.50",
     "B_C1": "-22.77",
     "PG_F1": "50.04",
     "CD_TIM1": "60",
     "SS_CY1": "16",
     "DPi_t1": "0"
 }
 #当日发电量
 msg['Etdy_ge1'] = data.get_value(i, 'generationValue')
 #当日用电量
 msg['Etdy_use1'] = data.get_value(i, 'useValue')
 #当日并网量
 msg['t_gc_tdy1'] = data.get_value(i, 'gridValue')
 msg['Etdy_pu1'] = data.get_value(i, 'buyValue')
 #当日放电量
 msg['Etdy_dcg1'] = data.get_value(i, 'dischargeValue')
 msg['Etdy_cg1'] = data.get_value(i, 'chargeValue')
 # msg['zu']=true
 producer = KafkaProducer(bootstrap_servers=server_list,
                          compression_type='gzip')
 print(type(msg))
 # bmsg = str(msg)
 # bmsg = str(msg).encode('utf-8')
 bmsg = bytes(str(msg).encode('utf-8'))
Beispiel #3
0
buy_use=a[2]
# generationValue1=a[3]
# useValue1=a[4]
# gridValue1=a[5]
# buyValue1=a[6]
# chargeValue1=a[7]
# dischargeValue1=a[8]

self_usetotal=0
self_chargetotal=0
buy_usetotal=0

i=0
#模拟288条数据
while i<20:
    generationValue1=data.get_value(13524-i,'generationValue')
    useValue1=data.get_value(13524-i,'useValue')
    gridValue1=data.get_value(13524-i,'gridValue')
    buyValue1=data.get_value(13524-i,'buyValue')
    chargeValue1=data.get_value(13524-i,'chargeValue')
    dischargeValue1=data.get_value(13524-i,'dischargeValue')
    generationValue2=data.get_value(13523-i,'generationValue')
    useValue2=data.get_value(13523-i,'useValue')
    gridValue2=data.get_value(13523-i,'gridValue')
    buyValue2=data.get_value(13523-i,'buyValue')
    chargeValue2=data.get_value(13523-i,'chargeValue')
    dischargeValue2=data.get_value(13523-i,'dischargeValue')

   #增量数据
    if (generationValue2-generationValue1)<0:
        generation_increment2=min(0,generationValue2-generationValue1)
Beispiel #4
0
result2 = result['result']
result2_len = len(result2)
# print (result2)
# print (type(result2))
result3 = []
j = 0
while j < result2_len:
    result4 = result2[j]['eventvalue']
    print(result4)
    result3.append(result4)
    j += 1

mydata = ExcleHelper(r'D:\xingit\wsy\ApiAuto-py3\config\maidian.xlsx',
                     'Sheet1')
rows_num = mydata.get_row()
print(rows_num)
i = 1

while i < rows_num:
    maidian_data = mydata.get_value(i, '埋点编号')
    maidian_data2 = int(maidian_data)
    # print (maidian_data2)
    maidian_data3 = str(maidian_data2)
    # print (maidian_data3)
    if maidian_data3 in result3:
        # print ('该埋点:%s已在talkdata中'%maidian_data3)
        print('pass')
    else:
        print('该埋点:%s不在talkdata中' % maidian_data3)
    i = i + 1
Beispiel #5
0
#encoding=utf-8
import requests, json
from src.common.excel_simple import ExcleHelper
data = ExcleHelper(r'D:\xingit\wsy\ApiAuto-py3\config\test.xlsx', 'role')
cache = {}
url = data.get_value('login_username', 'url')
path1 = data.get_value('login_username', 'path')
headers1 = data.get_value('login_username', 'headers')
base_params1 = data.get_value('login_username', 'params')
path2 = data.get_value('get_list', 'path')
path3 = data.get_value('login_username1', 'path')
headers3 = data.get_value('login_username1', 'headers')
base_params3 = data.get_value('login_username1', 'params')
path4 = data.get_value('get_userinfo', 'path')
path5 = data.get_value('modify_role', 'path')
path6 = data.get_value('role_info', 'path')

payload1 = json.loads(base_params1)
head1 = json.loads(headers1)
payload3 = json.loads(base_params3)
head3 = json.loads(headers3)

print(url + path1)
print(url + path2)
print(url + path3)
print(url + path4)
print(url + path5)
print(url + path6)


def login():