def call_server_upload_pdf_attachment(router, files, code): url = 'http://{ip}:{port}/{router}'.format( router=router, ip=utils.ip(), port=utils.port()) + '' try: utils.post_file_with_code(url, files, code, headers=None) except Exception as e: logging.error(repr(e)) raise RuntimeError('上传附件到服务器未知异常')
def call_server_save_data(router, params): url = 'http://{ip}:{port}/{router}'.format(router=router, ip=utils.ip(), port=utils.port()) params = {"params": params} try: resp = utils.post(url=url, params=params) except Exception as e: logging.error(repr(e)) raise RuntimeError('保存数据到服务器未知异常')
def call_server_upload_zip(router, files): url = 'http://{ip}:{port}/{router}'.format(router=router, ip=utils.ip(), port=utils.port()) try: resp = utils.post_file_data(url=url, params=files) return resp except Exception as e: logging.error(repr(e)) raise RuntimeError('上传zip到服务器未知异常')
def call_server_generate_zip(router, params): url = 'http://{ip}:{port}/{router}'.format(router=router, ip=utils.ip(), port=utils.port()) params = {"operation": params} try: resp = utils.post_form_data( url=url, params=params, headers={'Content-Type': 'application/x-www-form-urlencoded'}) except Exception as e: logging.error(repr(e)) raise RuntimeError('服务器生成zip未知异常')
def get_base_elements(code): data = {'code': code} url = 'http://{ip}:{port}/base-element/search'.format(ip=utils.ip(), port=utils.port()) params = {"id": None, "params": data} try: resp = utils.post(url=url, params=params) if 'error' in resp: raise RuntimeError('获取服务器excel配置未知异常') for re in resp: if re.get('status'): re['status'] = '1' else: re['status'] = '0' df1 = pd.DataFrame(resp) for df in df1: df1.rename(columns={df: hump2Underline(df)}, inplace=True) data = df1.to_dict(orient='records') return data except Exception as e: logging.error(repr(e)) raise RuntimeError('获取服务器excel配置未知异常')
def save_data(data): url = 'http://{ip}:{port}/sup-agreement/excel/prepare'.format(ip=utils.ip(), port=utils.port()) params = { "params": data } resp = utils.post(url=url, params=params)
def save_data(data): url = 'http://{ip}:{port}/pr-isda/excel/prepare'.format(ip=utils.ip(), port=utils.port()) params = { "params": data } resp = utils.put(url=url, params=params)
def save_data(data): url = 'http://{ip}:{port}/swap-termination/excel/prepare'.format( ip=utils.ip(), port=utils.port()) params = {"params": data} resp = utils.post(url=url, params=params)
def save_data(data): url = 'http://{ip}:{port}/master-product-list/excel/prepare'.format( ip=utils.ip(), port=utils.port()) params = {"params": data} resp = utils.post(url=url, params=params)
def save_data(data): url = 'http://{ip}:{port}/contract-number/excel/prepare'.format( ip=utils.ip(), port=utils.port()) params = {"params": data} resp = utils.post(url=url, params=params)
def save_data(data): url = 'http://{ip}:{port}/performance-guarantee/excel/prepare'.format( ip=utils.ip(), port=utils.port()) params = {"params": data} resp = utils.post(url=url, params=params)