def entYearReportInfo(id=None, creditcode=None, regno=None, enttype=1): """ :document: YearReport(企业年报查询),输入企业的id,统一信用代码,注册号返回企业年报信息 :param id: string,中数企业ID :param creditcode: string,统一信用代码 :param regno: string,企业注册号 :param enttype: string,企业类型:1-企业 2-个人 :return: """ # 拼接url uri = urljoin(BASEPATH, "entYearReportInfo") # 组装body params = {} params["id"] = id params["creditcode"] = creditcode params["regno"] = regno params["enttype"] = enttype # 发送http请求 req = RestUtil() ret = req.get(uri, params) if ret: return ret else: return False
def entRiskInfo(id=None, creditcode=None, regno=None, enttype=1): """ :document: entRiskInfo(风险信息查询),输入企业的id,统一信用代码,注册号返回企业风险信息(包含被执行人信息,失信被执行人信息,行政处罚信息,经营异常名录) :param id: string,中数企业ID :param creditcode: string,统一信用代码 :param regno: string,企业注册号 :param enttype: string,企业类型:1-企业 2-个人 :return: """ # 拼接url uri = urljoin(BASEPATH, "entRiskInfo") # 组装body params = {} params["id"] = id params["creditcode"] = creditcode params["regno"] = regno params["enttype"] = enttype # 发送http请求 req = RestUtil() ret = req.get(uri, params) if ret: return ret else: return False
def entStatisticalInfo(id=None, creditcode=None, regno=None, mask="1101000001000001000000000110001000", enttype=1): """ :document: entStatisticalInfo(企业统计信息查询),输入企业的id,统一信用代码,注册号统计企业信息 :param id: string,中数企业ID :param creditcode: string,统一信用代码 :param regno: string,企业注册号 :param mask: string,查询掩码 :param enttype: string,企业类型:1-企业 2-个人 :return: """ # 拼接url uri = urljoin(BASEPATH, "enterprises/statisticalInfo") # 组装body params = {} params["id"] = id params["creditcode"] = creditcode params["regno"] = regno params["mask"] = mask params["enttype"] = enttype # 发送http请求 req = RestUtil() ret = req.get(uri, params) if ret: return ret else: return False
def entOperationStateInfo(id=None, creditcode=None, regno=None, enttype=1): """ :document: OperationState(查询企业经营状态),根据企业id,统一信用代码或注册号查询企业经营状态 :param id: string,中数企业ID :param creditcode: string,统一信用代码 :param regno: string,企业注册号 :param enttype: string,企业类型:1-企业 2-个人 :return: """ # 拼接url uri = urljoin(BASEPATH, "entOperationStateInfo") # 组装body params = {} params["id"] = id params["creditcode"] = creditcode params["regno"] = regno params["enttype"] = enttype # 发送http请求 req = RestUtil() ret = req.get(uri, params) if ret: return ret else: return False
def enterpriseListBasic(key, page=None, size=20): """ :document: enterpriseListBasic(企业名录通用版), 输入企业名称返回企业列表 :param key: string,查询企业的名称 :param page: integer,当前页数 :param size: integer,每页返回的数据数量 :return: """ # 拼接url uri = urljoin(BASEPATH, "enterprisesList/basic") # 组装body params = {} params["key"] = key params["page"] = page params["size"] = size # 发送http请求 req = RestUtil() ret = req.get(uri, params) if ret: return ret else: return False
def entTrademarkInfo(id=None, creditcode=None, regno=None, enttype=1): """ :document: entRiskInfo(风险信息查询),输入企业的id,统一信用代码,注册号返回企业商标信息(其中MARKIMAGE是图片二进制编码的base64编码) :param id: string,中数企业ID :param creditcode: string,统一信用代码 :param regno: string,企业注册号 :param enttype: string,企业类型:1-企业 2-个人 :return: """ # 拼接url uri = urljoin(BASEPATH, "entTrademarkInfo") # 组装body params = {} params["id"] = id params["creditcode"] = creditcode params["regno"] = regno params["enttype"] = enttype # 发送http请求 req = RestUtil() ret = req.get(uri, params) if ret: return ret else: return False
def executive2(name, entName, identity, personType=None): """ :document: executive2(人员任职核验v2),验证人员是否是查询企业的董事、法人、管理 :param name: string,姓名 :param entName: string,企业标识(输入:企业全称/注册号/组织机构代码/统一社会信用代码) :param identity: string,身份证号码验证是否是15或18位字符 :param personType: string,人员类型(legal:法人,shareholder:股东,priperson:高管); :return: """ # 拼接url uri = urljoin(BASEPATH, "verify/executive/v2") # 组装body params = {} params["name"] = name params["entName"] = entName params["identity"] = identity params["personType"] = personType # 发送http请求 req = RestUtil() ret = req.get(uri, params) if ret: return ret else: return False
def telecom(name, mobile, identity): """ :document: telecom(电信三要素核验),验证姓名、手机号、身份证号码是否一致 :param name: string,姓名 :param mobile: string,手机号验证是否是11位数字 :param identity: string,身份证号码验证是否是15或18位字符 :return: """ # 拼接url uri = urljoin(BASEPATH, "verify/telecom") # 组装body params = {} params["name"] = name params["mobile"] = mobile params["identity"] = identity # 发送http请求 req = RestUtil() ret = req.get(uri, params) if ret: return ret else: return False
def relation(name, entName, identity): """ :document: entPerson(人企关联核验),验证人员是否和查询企业的有关联(董事、法人、管理) :param name: string,姓名 :param entName: string,企业标识(输入:企业全称/注册号/组织机构代码/统一社会信用代码) :param identity: string,身份证号码验证是否是15或18位字符 :return: """ # 拼接url uri = urljoin(BASEPATH, "verify/relation") # 组装body params = {} params["name"] = name params["entName"] = entName params["identity"] = identity # 发送http请求 req = RestUtil() ret = req.get(uri, params) if ret: return ret else: return False
def enterpriseListPro(key, areaCode=None, industryPhy=None, entStatus=None, regcapGte=None, regcapLte=None, enableAggregate=False, page=None, size=20): """ :document: enterpriseListPro(企业名录专业版), 输入企业名称返回企业列表 :param key: string,查询企业的名称 :param areaCode: string,区域代码 :param industryPhy: string,行业代码 :param entStatus: string,企业经营状态,1:在营,2:吊销,3:注销,4:迁出,8:停业,9:其他,9_01:撤销,9_02:待迁入,9_03:经营期限届满;9_04:清算中;9_05:停业 :param regcapGte: string,最小注册资本(万元) :param regcapLte: string,最大注册资本(万元) :param enableAggregate: string,是否按照区域代码和行业代码统计数量,统计:true,不统计:false(默认选项) :param page: integer,当前页数 :param size: integer,每页返回的数据数量 :return: """ # 拼接url uri = urljoin(BASEPATH, "enterprises") # 组装body params = {} params["key"] = key params["areaCode"] = areaCode params["industryPhy"] = industryPhy params["entStatus"] = entStatus params["regcapGte"] = regcapGte params["regcapLte"] = regcapLte params["enableAggregate"] = enableAggregate params["page"] = page params["size"] = size # 发送http请求 req = RestUtil() ret = req.get(uri, params) if ret: return ret else: return False
def thrcheck(entId): """ :document: thrcheck(企业名称一致性核验),企业名称在工商局、质监局、税务局登记一致性数据核验;entId企业标识(注册号/统一社会信用代码) :param entId: string,企业标识(注册号/统一社会信用代码) :return: """ # 拼接url uri = urljoin(BASEPATH, "verify/thrcheck") # 组装body params = {} params["entId"] = entId # 发送http请求 req = RestUtil() ret = req.get(uri, params) if ret: return ret else: return False
def period_call(query_url, compare_func, timeout, interval=1): """ 周期性执行query_func,用compare_func判断query结果是否符合预期。 如果一直没符合预期,达到timeout,抛出异常 """ count = 0 while count <= timeout: status, result = RestUtil.get(query_url) if compare_func(status, result): break time.sleep(interval) count += interval else: raise Exception("Error: query %s timeout" % query_url)
def entPerson(entName, personName): """ :document: entPerson(企业人员探查),根据企业名称、人员姓名查询人员信息 :param entName: string,中数企业ID :param personName: string,统一信用代码 :return: """ # 拼接url uri = urljoin(BASEPATH, "entperson") # 组装body params = {} params["entName"] = entName params["personName"] = personName # 发送http请求 req = RestUtil() ret = req.get(uri, params) if ret: return ret else: return False
# !/usr/bin/env python # -*- coding: utf-8 -*- from lib.rest import RestUtil contenttype="application/json" timestamp="1477880605762" nonce="-279565889" uid="YJ1M71RC" signature="26b6abcf8a732e2ca79a77f8a5a6d137e080b229" url="https://testapi.bidata.com.cn/platform/v3/enterprises?key=汉柏科技" default_headers = { "Content-Type": contenttype, "X-Uid":uid, "X-Nonce":nonce, "X-Timestamp":timestamp, "X-Signature":signature } uri = "https://testapi.bidata.com.cn/platform/v3/enterprises" params = {"key":"汉柏科技"} ret = RestUtil() result = ret.get(uri,params) print result