# python3 ./src/import-brokerinfo.py
import pandas as pd
import requests
import math
def read_df(file_name, sheet_name):
brokerinfo_df = pd.read_excel(file_name, sheet_name=sheet_name)
return brokerinfo_df
if __name__ == "__main__":
brokerinfo_df = read_df("./files/下游公司名称-20231022.xlsx","下游公司名称")
res = brokerinfo_df.to_dict("records")
url='https://houseagent.Manage/brokerfirm/addBrokerInfo'
# Cookie 需要先在浏览器中登陆对应的账号获取到
headers={
'Accept':'*/*',
'Accept-Language':'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
'Accept-Encoding':'gzip, deflate, br',
'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8',
'Origin': 'https://houseagent.,
'Cookie':'SECKEY_ABVK=kJIADDBaBHkHxt6PLr/WVOeSoPxCLQEJ/XA0E3oPaPU%3D; BMAP_SECKEY=2jrit5pFMiqfJiFbt3kdaPqO4VsELZrHuBerMtqarg1F27u5JH85lI3tG-P_b6ZhYGg-970n59U-EwSg-2KLRf6Iocx52aJT48eWenr8Uot-hIRCanz8Qpyt4DQ9WYQyT85tcGeB6IBHMueVNXkUMzVGM9hvJnE82NVoJoD8ouv4IWZKYYytbwxgemDVamP-; HEJIAYUE_JSESSIONID=e57fe732-6644-4792-b84e-61ff7aea1622'
}
for rowData in res:
data={
'enterpriseName': rowData["新公司名称"] if not str(rowData["新公司名称"]).isspace() and str(rowData["新公司名称"]) !='nan' else rowData['下游公司名称'],
'taxpayerNumber':rowData['纳税人识别号'],
'address':rowData['地址'],
'contact':rowData['电话'],
'bankName':rowData['开户行'],
'bankAccount':rowData['银行账户'],
'brokerOrganizeName':rowData["新公司名称"] if not str(rowData["新公司名称"]).isspace() and str(rowData["新公司名称"]) !='nan' else rowData['下游公司名称'],
'organShortName':f'脚本导入数据无简介{rowData["序号"]}',
'licenseCode':rowData['营业执照号码'],
'accountName':rowData['管理员'],
'mobilephone':rowData['手机号'],
'accountNo':''
}
r = requests.post(url=url,data=data,headers=headers)
print(f'{rowData["序号"]},{rowData["下游公司名称"]}:{r.text}')